Part Number Hot Search : 
BU2727DX 15KP110 AXE25 KB1365 LC5864H G2030 MOC3063 E100A
Product Description
Full Text Search
 

To Download UPD70F3288GJ-UEN-A Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  document no. u16603ej5v1ud00 (5th edition) date published march 2008 n printed in japan user?s manual v850es/sj2, v850es/sj2-h 32-bit single-chip microcontrollers hardware 2003, 2008 v850es/sj2: pd703264 pd703274 pd703284 pd70f3284 pd703264y pd703274y pd703284y pd70f3284y pd703265 pd703275 pd703285 pd70f3286 pd703265y pd703275y pd703285y pd70f3286y pd703266 pd703276 pd703286 pd70f3288 pd703266y pd703276y pd703286y pd70f3288y pd70f3264 pd70f3274 pd703287 pd70f3264y pd70f3274y pd703287y pd70f3266 pd70f3276 pd703288 pd70f3266y pd70f3276y pd703288y v850es/sj2-h: pd703265hy pd703275hy pd703285hy pd703287hy pd703266hy pd703276hy pd703286hy pd703288hy pd70f3266hy pd70f3276hy pd70f3286hy pd70f3288hy
user?s manual u16603ej5v1ud 2 [memo]
user?s manual u16603ej5v1ud 3 1 2 3 4 voltage application waveform at input pin waveform distortion due to input noise or a reflected wave may cause malfunction. if the input of the cmos device stays in the area between v il (max) and v ih (min) due to noise, etc., the device may malfunction. take care to prevent chattering noise from entering the device when the input level is fixed, and also in the transition period when the input level passes through the area between v il (max) and v ih (min). handling of unused input pins unconnected cmos device inputs can be cause of malfunction. if an input pin is unconnected, it is possible that an internal input level may be generated due to noise, etc., causing malfunction. cmos devices behave differently than bipolar or nmos devices. input levels of cmos devices must be fixed high or low by using pull-up or pull-down circuitry. each unused pin should be connected to v dd or gnd via a resistor if there is a possibility that it will be an output pin. all handling related to unused pins must be judged separately for each device and according to related specifications governing the device. precaution against esd a strong electric field, when exposed to a mos device, can cause destruction of the gate oxide and ultimately degrade the device operation. steps must be taken to stop generation of static electricity as much as possible, and quickly dissipate it when it has occurred. environmental control must be adequate. when it is dry, a humidifier should be used. it is recommended to avoid using insulators that easily build up static electricity. semiconductor devices must be stored and transported in an anti-static container, static shielding bag or conductive material. all test and measurement tools including work benches and floors should be grounded. the operator should be grounded using a wrist strap. semiconductor devices must not be touched with bare hands. similar precautions need to be taken for pw boards with mounted semiconductor devices. status before initialization power-on does not necessarily define the initial status of a mos device. immediately after the power source is turned on, devices with reset functions have not yet been initialized. hence, power-on does not guarantee output pin levels, i/o settings or contents of registers. a device is not initialized until the reset signal is received. a reset operation must be executed immediately after power-on for devices with reset functions. power on/off sequence in the case of a device that uses different power supplies for the internal operation and external interface, as a rule, switch on the external power supply after switching on the internal power supply. when switching the power supply off, as a rule, switch off the external power supply and then the internal power supply. use of the reverse power on/off sequences may result in the application of an overvoltage to the internal elements of the device, causing malfunction and degradation of internal elements due to the passage of an abnormal current. the correct power on/off sequence must be judged separately for each device and according to related specifications governing the device. input of signal during power off state do not input signals or an i/o pull-up power supply while the device is not powered. the current injection that results from input of such a signal or i/o pull-up power supply may cause malfunction and the abnormal current that passes in the device at this time may cause degradation of internal elements. input of signals during the power off state must be judged separately for each device and according to related specifications governing the device. notes for cmos devices 5 6
user?s manual u16603ej5v1ud 4 iecube is a registered trademark of nec corporation in japan and germany. minicube is a registered trademark of nec electronics corporation in jap an and germany or a trademark in the united states of america. eeprom, iebus, and inter equipment bus are trademarks of nec electronics corporation. windows and windows nt are either re gistered trademarks or trademarks of microsoft corporation in the united states and/or other countries. pc/at is a trademark of internati onal business machines corporation. sparcstation is a trademark of sparc international, inc. solaris and sunos are trademar ks of sun microsystems, inc.
user?s manual u16603ej5v1ud 5 these commodities, technology or software, must be exported in accordance with the export administration regulations of the exporting country. diversion contrary to the law of that country is prohibited. the information in this document is current as of october, 2007. the information is subject to change without notice. for actual design-in, refer to the latest publications of nec electronics data sheets or data books, etc., for the most up-to-date specifications of nec electronics products. not all products and/or types are available in every country. please check with an nec electronics sales representative for availability and additional information. no part of this document may be copied or reproduced in any form or by any means without the prior written consent of nec electronics. nec electronics assumes no responsibility for any errors that may appear in this document. nec electronics does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from the use of nec electronics products listed in this document or any other liability arising from the use of such products. no license, express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of nec electronics or others. descriptions of circuits, software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples. the incorporation of these circuits, software and information in the design of a customer's equipment shall be done under the full responsibility of the customer. nec electronics assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits, software and information. while nec electronics endeavors to enhance the quality, reliability and safety of nec electronics products, customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. to minimize risks of damage to property or injury (including death) to persons arising from defects in nec electronics products, customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment and anti-failure features. nec electronics products are classified into the following three quality grades: "standard", "special" and "specific". the "specific" quality grade applies only to nec electronics products developed based on a customer- designated "quality assurance program" for a specific application. the recommended applications of an nec electronics product depend on its quality grade, as indicated below. customers must check the quality grade of each nec electronics product before using it in a particular application. "standard": computers, office equipment, communications equipment, test and measurement equipment, audio and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots. "special": transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster systems, anti-crime systems, safety equipment and medical equipment (not specifically designed for life support). "specific": aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support systems and medical equipment for life support, etc. the quality grade of nec ele ctronics prod ucts is "standard" unless otherwise expressly specified in nec electronics data sheets or data books, etc. if customers wish to use nec electronics products in applications not intended by nec electronics, they must contact an nec electronics sales representative in advance to determine nec electronics' willingness to support a given application. (note) (1) "nec electronics" as used in this statement means nec electronics corporation and also includes its majority-owned subsidiaries. (2) "nec electronics products" means any product developed or manufactured by or for nec electronics (as defined above). ? ? ? ? ? ? m8e 02. 11-1
user?s manual u16603ej5v1ud 6 preface readers this manual is intended for users who wish to understand the functions of the v850es/sj2 and v850es/sj2-h products and design application systems using these products. purpose this manual is intended to give users an understanding of the har dware functions of the v850es/sj2 and v850es/sj2-h shown in the organization below. organization this manual is divided into two parts: hardware (this manual) and architecture ( v850es architecture user?s manual ). hardware architecture ? pin functions ? data types ? cpu function ? register set ? on-chip peripheral functions ? instruction format and instruction set ? flash memory programming ? interrupts and exceptions ? electrical specifications ? pipeline operation how to read this manual it is assumed that the readers of this m anual have general knowledge in the fields of electrical engineering, logic circuits, and microcontrollers. to understand the overall functions of the v850es/sj2 and v850es/sj2-h read this manual according to the contents . to find the details of a regi ster where the name is known use appendix c register index . register format the name of the bit whose number is in angle brackets (<>) in the figure of the register format of each register is defi ned as a reserved word in the device file. to understand the details of an instruction function refer to the v850es architecture user?s manual available separately. to know the electrical specificati ons of the v850es/sj2 and v850es/sj2-h see chapter 32 electrical specifications . the ?yyy bit of the xxx register? is described as the ?xxx.yyy bit? in this manual. note with caution that if ?xxx. yyy? is described as is in a program, however, the compiler/assembler cannot recognize it correctly. the mark shows major revised point s. the revised points can be easily searched by copying an ?? in the pdf file and specifying it in the ?find what:? field.
user?s manual u16603ej5v1ud 7 conventions data significance: higher digits on the left and lower digits on the right active low representation: xxx (ove rscore over pin or signal name) memory map address: higher addresse s on the top and lower addresses on the bottom note: footnote for item marked with note in the text caution: information requiring particular attention remark: supplementary information numeric representation: binary ... xxxx or xxxxb decimal ... xxxx hexadecimal ... xxxxh prefix indicating power of 2 (address space, memory capacity): k (kilo): 2 10 = 1,024 m (mega): 2 20 = 1,024 2 g (giga): 2 30 = 1,024 3
user?s manual u16603ej5v1ud 8 related documents the related documents indicated in this pub lication may include preliminary versions. however, preliminary versions are not marked as such. documents related to v 850es/sj2, v850es/sj2-h document name document no. v850es architecture user?s manual u15943e v850es/sj2, v850es/sj2-h hardwa re user?s manual this manual documents related to development tools document name document no. ie-v850es-g1 (in-circuit emulator) u16313e ie-703288-g1-em1 (in-circuit em ulator option board) u16697e ie-v850e1-cd-nw (pcmcia card ty pe on-chip debug emulator) u16647e qb-v850essx2 (in-circuit emulator) u17091e qb-v850mini (on-chip debug emulator) u17638e qb-mini2 (on-chip debug emulator with programming function) u18371e operation u17293e c language u17291e assembly language u17292e ca850 ver. 3.00 c compiler package link directive u17294e pm+ ver. 6.30 project manager u18416e id850 ver. 3.00 integrated debugger operation u17358e id850qb ver. 3.40 integrated debugger operation u18604e tw850 ver. 2.00 performance analysis tuning tool u17241e operation u18601e sm+ system simulation user open interface u18212e basics u13430e installation u17419e technical u13431e rx850 ver. 3.20 real-time os task debugger u17420e basics u18165e installation u17421e technical u13772e rx850 pro ver. 3.21 real-time os task debugger u17422e az850 ver. 3.30 system performance analyzer u17423e pg-fp4 flash memory programmer u15260e pg-fp5 flash memory programmer u18865e
user?s manual u16603ej5v1ud 9 contents chapter 1 introduction ...................................................................................................... ...........22 1.1 general ........................................................................................................................ .............22 1.2 features....................................................................................................................... .............26 1.3 application fields ............................................................................................................. ......27 1.4 ordering information ........................................................................................................... ...28 1.5 pin configuration (top view) ......................................... ........................................................30 1.6 function block configuration........................................ ........................................................33 1.6.1 internal bl ock di agram ......................................................................................................... ...... 33 1.6.2 internal units ................................................................................................................. ............. 34 chapter 2 pin funct ions.................................................................................................... ............37 2.1 list of pin functions.......................................................................................................... .....37 2.2 pin states ..................................................................................................................... ............49 2.3 pin i/o circuit types, i/o buffer power suppli es, and connection of unused pins........50 2.4 cautions ....................................................................................................................... ............54 chapter 3 cpu function..................................................................................................... ............55 3.1 features....................................................................................................................... .............55 3.2 cpu register set............................................................................................................... ......56 3.2.1 program regi ster set ........................................................................................................... ....... 57 3.2.2 system regi ster set............................................................................................................ ........ 58 3.3 operation modes ................................................................................................................ .....64 3.3.1 specifying oper ation mode ...................................................................................................... .. 64 3.4 address space .................................................................................................................. ......65 3.4.1 cpu address space.............................................................................................................. ..... 65 3.4.2 wraparound of cpu addr ess spac e .......................................................................................... 66 3.4.3 memory map..................................................................................................................... ......... 67 3.4.4 areas .......................................................................................................................... ............... 69 3.4.5 recommended use of address s pace ....................................................................................... 75 3.4.6 peripheral i/o regist ers....................................................................................................... ....... 77 3.4.7 programmable peripheral i/o regist ers...................................................................................... 90 3.4.8 special r egister s .............................................................................................................. .......... 90 3.4.9 cauti ons ....................................................................................................................... ............. 94 chapter 4 port f unctions................................................................................................... .........99 4.1 features....................................................................................................................... .............99 4.2 basic port configuration ....................................................................................................... .99 4.3 port configuration........................................................... .................................................. ....100 4.3.1 port 0......................................................................................................................... .............. 104 4.3.2 port 1......................................................................................................................... .............. 107 4.3.3 port 3......................................................................................................................... .............. 108 4.3.4 port 4......................................................................................................................... .............. 114 4.3.5 port 5......................................................................................................................... .............. 117
user?s manual u16603ej5v1ud 10 4.3.6 port 6 ......................................................................................................................... ..............121 4.3.7 port 7 ......................................................................................................................... ..............125 4.3.8 port 8 ......................................................................................................................... ..............127 4.3.9 port 9 ......................................................................................................................... ..............129 4.3.10 port cd ........................................................................................................................ ............137 4.3.11 port cm ........................................................................................................................ ...........138 4.3.12 port cs ........................................................................................................................ ............140 4.3.13 port ct ........................................................................................................................ ............142 4.3.14 port dh ........................................................................................................................ ............144 4.3.15 port dl ........................................................................................................................ ............146 4.4 block diagrams................................................................................................................. .... 148 4.5 port register settings when alternate function is used ................................................ 185 4.6 cautions ....................................................................................................................... ......... 195 4.6.1 cautions on se tting port pins .................................................................................................. .195 4.6.2 cautions on bit manipulation instru ction for port n r egister (pn) ...............................................198 4.6.3 cautions on on-ch ip debug pi ns...............................................................................................19 9 4.6.4 cautions on p05/in tp2/drst pin...........................................................................................199 4.6.5 cautions on p10, p11, and p53 pi ns when power is turned on ............................................... 199 4.6.6 hysteresis char acterist ics ..................................................................................................... ...199 4.6.7 cautions on separ ate bus mode ..............................................................................................199 chapter 5 bus control function ................................ .......................................................... 20 0 5.1 features....................................................................................................................... .......... 200 5.2 bus control pins............................................................................................................... .... 201 5.2.1 pin status when internal rom, internal ra m, or on-chip peripher al i/o is a ccessed...............201 5.2.2 pin status in eac h operation mode ...........................................................................................201 5.3 memory block function....................................................................................................... 202 5.4 external bus interface mode control function ......... ........................................................ 203 5.5 bus access ..................................................................................................................... ...... 204 5.5.1 number of clo cks for a ccess.................................................................................................... 204 5.5.2 bus size setti ng func tion ...................................................................................................... ....205 5.5.3 access by bus si ze ............................................................................................................. .....206 5.6 wait function .................................................................................................................. ...... 213 5.6.1 programmable wait function ....................................................................................................2 13 5.6.2 external wait func tion......................................................................................................... ......214 5.6.3 relationship between programmabl e wait and exte rnal wa it ................................................... 215 5.6.4 programmable address wait func tion .......................................................................................216 5.7 idle state insertion function ............................................................................................... 217 5.8 bus hold function.............................................................................................................. .. 218 5.8.1 functional outlin e............................................................................................................. ........218 5.8.2 bus hold pr ocedur e............................................................................................................. .....219 5.8.3 operation in power save mode ................................................................................................219 5.9 bus priority ................................................................................................................... ........ 220 5.10 bus timing ..................................................................................................................... ....... 221 chapter 6 clock generation function .................... .......................................................... 227 6.1 overview....................................................................................................................... ......... 227
user?s manual u16603ej5v1ud 11 6.2 configuration .................................................................................................................. .......228 6.3 registers ...................................................................................................................... ..........230 6.4 operation...................................................................................................................... ..........235 6.4.1 operation of each cl ock........................................................................................................ ... 235 6.4.2 clock output functi on .......................................................................................................... ..... 235 6.5 pll function................................................................................................................... .......236 6.5.1 overvi ew ....................................................................................................................... .......... 236 6.5.2 regist ers ...................................................................................................................... ........... 236 6.5.3 usage .......................................................................................................................... ............ 239 chapter 7 16-bit timer/event counter p (tmp) .. ...............................................................240 7.1 overview....................................................................................................................... ..........240 7.2 functions ...................................................................................................................... .........240 7.3 configuration .................................................................................................................. .......241 7.4 registers ...................................................................................................................... ..........243 7.5 timer output operations............................................ ..........................................................25 6 7.6 operation...................................................................................................................... ..........257 7.6.1 interval timer mode (tpnmd2 to tpnmd0 bi ts = 000)............................................................. 264 7.6.2 external event count mode (tpn md2 to tpnmd0 bits = 001)................................................. 276 7.6.3 external trigger pulse output mode (tpnmd2 to tpnmd0 bits = 010) ..................................... 285 7.6.4 one-shot pulse output mode (tpn md2 to tpnmd0 bits = 011) .............................................. 297 7.6.5 pwm output mode (tpnmd2 to tpnmd0 bi ts = 100).............................................................. 304 7.6.6 free-running timer mode (tpnmd2 to tpnmd0 bi ts = 101) .................................................... 313 7.6.7 pulse width measurement mode (tpn md2 to tpnmd0 bits = 110) ........................................ 331 7.7 selector function .............................................................................................................. ....337 chapter 8 16-bit timer/event counter q (tmq) ... .............................................................339 8.1 overview....................................................................................................................... ..........339 8.2 functions ...................................................................................................................... .........339 8.3 configuration .................................................................................................................. .......340 8.4 registers ...................................................................................................................... ..........342 8.5 timer output operations .......................................................................................................3 58 8.6 operation...................................................................................................................... ..........359 8.6.1 interval timer mode (tq0md2 to tq0md0 bi ts = 000) ............................................................ 366 8.6.2 external event count mode (tq0 md2 to tq0md0 bits = 001) ................................................ 377 8.6.3 external trigger pulse output mode (tq0md2 to tq0md0 bits = 010) .................................... 387 8.6.4 one-shot pulse output mode (tq0 md2 to tq0md0 bits = 011) ............................................. 400 8.6.5 pwm output mode (tq0md2 to tq0md0 bi ts = 100) ............................................................. 409 8.6.6 free-running timer mode (tq0md2 to tq0md0 bi ts = 101) ................................................... 420 8.6.7 pulse width measurement mode (tq0 md2 to tq0md0 bits = 110)........................................ 441 8.7 selector function .............................................................................................................. ....446 chapter 9 16-bit interval timer m (tmm).......... ...................................................................447 9.1 overview....................................................................................................................... ..........447 9.2 configuration .................................................................................................................. .......448 9.3 register ....................................................................................................................... ...........449
user?s manual u16603ej5v1ud 12 9.4 operation...................................................................................................................... ......... 450 9.4.1 interval ti mer m ode ............................................................................................................ ......450 9.4.2 cauti ons....................................................................................................................... ............454 chapter 10 watch timer functions ............................ .......................................................... 455 10.1 functions...................................................................................................................... ......... 455 10.2 configuration .................................................................................................................. ...... 456 10.3 control registers .............................................................................................................. ... 458 10.4 operation...................................................................................................................... ......... 462 10.4.1 operation as watch ti mer ....................................................................................................... ..462 10.4.2 operation as in terval timer.................................................................................................... ...463 10.4.3 cauti ons....................................................................................................................... ............464 chapter 11 functions of watchdog timer 2 .. ................................................................. 465 11.1 functions...................................................................................................................... ......... 465 11.2 configuration .................................................................................................................. ...... 466 11.3 registers ...................................................................................................................... ......... 467 11.4 operation...................................................................................................................... ......... 469 chapter 12 real-time output function (rto).. ................................................................. 470 12.1 function....................................................................................................................... .......... 470 12.2 configuration .................................................................................................................. ...... 471 12.3 registers ...................................................................................................................... ......... 473 12.4 operation...................................................................................................................... ......... 475 12.5 usage .......................................................................................................................... ........... 476 12.6 cautions ....................................................................................................................... ......... 476 chapter 13 a/d converter ................................................................................................... ...... 477 13.1 overview....................................................................................................................... ......... 477 13.2 functions...................................................................................................................... ......... 477 13.3 configuration .................................................................................................................. ...... 478 13.4 registers ...................................................................................................................... ......... 481 13.5 operation...................................................................................................................... ......... 492 13.5.1 basic oper ation ................................................................................................................ ........492 13.5.2 conversion operat ion ti ming .................................................................................................... 493 13.5.3 trigger mode ................................................................................................................... ........494 13.5.4 operati on m ode ................................................................................................................. ......496 13.5.5 power-fail co mpare mode ........................................................................................................ 500 13.6 cautions ....................................................................................................................... ......... 505 13.7 how to read a/d converter characteristics table... ........................................................ 510 chapter 14 d/a converter ................................................................................................... ...... 514 14.1 functions...................................................................................................................... ......... 514 14.2 configuration .................................................................................................................. ...... 515 14.3 registers ...................................................................................................................... ......... 516
user?s manual u16603ej5v1ud 13 14.4 operation...................................................................................................................... ..........517 14.4.1 operation in normal mode ....................................................................................................... 517 14.4.2 operation in real-t ime output mode ......................................................................................... 517 14.4.3 cauti ons ....................................................................................................................... ........... 518 chapter 15 asynchronous serial interface a (uarta) ..............................................519 15.1 mode switching of uarta and other serial interf aces....................................................519 15.1.1 csib4 and uarta0 m ode switch ing ...................................................................................... 519 15.1.2 uarta2 and i 2 c00 mode swit ching ........................................................................................ 520 15.1.3 uarta1 and i 2 c02 mode swit ching ........................................................................................ 521 15.2 features....................................................................................................................... ...........522 15.3 configuration .................................................................................................................. .......523 15.4 registers ...................................................................................................................... ..........525 15.5 interrupt request signals......................... ............................................................................5 32 15.6 operation...................................................................................................................... ..........533 15.6.1 data fo rmat.................................................................................................................... .......... 533 15.6.2 sbf transmission/rec eption fo rmat.......................................................................................... 535 15.6.3 sbf trans missi on ............................................................................................................... ..... 537 15.6.4 sbf rec eptio n.................................................................................................................. ........ 538 15.6.5 uart trans missi on.............................................................................................................. .... 540 15.6.6 continuous transmi ssion proc edure ........................................................................................ 541 15.6.7 uart rec eptio n ................................................................................................................. ...... 543 15.6.8 reception errors ............................................................................................................... ....... 544 15.6.9 parity types and operat ions .................................................................................................... . 546 15.6.10 receive data noi se f ilter ...................................................................................................... .... 547 15.7 dedicated baud rate generator ................................. .........................................................548 15.8 cautions ....................................................................................................................... ..........556 chapter 16 3-wire variable-length serial i/o (csib) ....................................................557 16.1 mode switching of csib and other serial interfaces ........................................................557 16.1.1 csib4 and uarta0 m ode switch ing ...................................................................................... 557 16.1.2 csib0 and i 2 c01 mode swit ching ............................................................................................ 558 16.2 features....................................................................................................................... ...........559 16.3 configuration .................................................................................................................. .......560 16.4 registers ...................................................................................................................... ..........562 16.5 interrupt request signals......................... ............................................................................5 70 16.6 operation...................................................................................................................... ..........571 16.6.1 single transfer mode (master mode, transmi ssion m ode) ....................................................... 571 16.6.2 single transfer mode (master mode, recept ion m ode)............................................................. 573 16.6.3 single transfer mode (master mode, transmission/rec eption m ode)........................................ 575 16.6.4 single transfer mode (slave mode, transmi ssion m ode) .......................................................... 577 16.6.5 single transfer mode (slave mode, recept ion m ode) ............................................................... 579 16.6.6 single transfer mode (slave mode, transmission/rec eption m ode) .......................................... 581 16.6.7 continuous transfer mode (master mode, transmi ssion m ode) ............................................... 583 16.6.8 continuous transfer mode (master mode, recept ion m ode)..................................................... 585 16.6.9 continuous transfer mode (master m ode, transmission/re ception mode) ................................ 588 16.6.10 continuous transfer mode (slave mode, transmi ssion m ode).................................................. 592
user?s manual u16603ej5v1ud 14 16.6.11 continuous transfer mode (slave mode, recept ion m ode) ....................................................... 594 16.6.12 continuous transfer mode (slave m ode, transmission/re ception mode) ..................................597 16.6.13 reception error ................................................................................................................ ........601 16.6.14 clock ti ming ................................................................................................................... ..........602 16.7 output pins .................................................................................................................... ....... 604 16.8 baud rate generator............................................................................................................ 605 16.8.1 baud rate generatio n ........................................................................................................... ....606 16.9 cautions ....................................................................................................................... ......... 607 chapter 17 i 2 c bus ......................................................................................................................... . 608 17.1 mode switching of i 2 c bus and other serial interfaces ..... .............................................. 608 17.1.1 uarta2 and i 2 c00 mode swit ching .........................................................................................608 17.1.2 csib0 and i 2 c01 mode swit ching ............................................................................................609 17.1.3 uarta1 and i 2 c02 mode swit ching .........................................................................................610 17.2 features....................................................................................................................... .......... 611 17.3 configuration .................................................................................................................. ...... 612 17.4 registers ...................................................................................................................... ......... 616 17.5 i 2 c bus mode functions....................................................................................................... 632 17.5.1 pin confi guratio n .............................................................................................................. ........632 17.6 i 2 c bus definitions and control methods ..................... ..................................................... 633 17.6.1 start c onditi on................................................................................................................ ..........633 17.6.2 addre sses...................................................................................................................... ..........634 17.6.3 transfer direction specific ation ............................................................................................... .635 17.6.4 ack ............................................................................................................................ .............636 17.6.5 stop condi tion ................................................................................................................. .........637 17.6.6 wait state..................................................................................................................... ............638 17.6.7 wait state cance llation me thod ................................................................................................6 40 17.7 i 2 c interrupt request signals (intiicn) ......................... ..................................................... 641 17.7.1 master devic e operat ion........................................................................................................ ...642 17.7.2 slave device operation (when receiving slave address (addr ess matc h))................................645 17.7.3 slave device operation (when re ceiving extens ion c ode) ........................................................ 649 17.7.4 operation without communica tion ............................................................................................653 17.7.5 arbitration loss operation (operation as slave after arbi tration loss) .........................................654 17.7.6 operation when arbitration loss occurs ( no communication after arbitrati on loss) ...................656 17.8 interrupt request signal (intiicn) generation ti ming and wait control....................... 663 17.9 address match detection method ... ................................................................................... 664 17.10 error detection................................................................................................................ ...... 664 17.11 extension code................................................................................................................. .... 665 17.12 arbitration .................................................................................................................... ......... 666 17.13 wakeup function................................................................................................................ .. 667 17.14 communication reservation............................................................................................... 668 17.14.1 when communication reservation function is enabled (iicfn.iicr svn bit = 0) .......................668 17.14.2 when communication reservation function is disabled (iicfn.ii crsvn bit = 1).......................672 17.15 cautions ....................................................................................................................... ......... 673 17.16 communication operations ................................................................................................ 674 17.16.1 master operation in si ngle master system ................................................................................675 17.16.2 master operation in multimaste r system ..................................................................................676 17.16.3 slave oper ation................................................................................................................ ........679
user?s manual u16603ej5v1ud 15 17.17 timing of data communication ...........................................................................................683 chapter 18 iebus controller..................................... ........................................................... ....690 18.1 functions ...................................................................................................................... .........690 18.1.1 communication protoc ol of i ebus ........................................................................................... 690 18.1.2 determination of bus mast ership (arb itrati on).......................................................................... 691 18.1.3 communicati on m ode............................................................................................................. . 691 18.1.4 communicati on addres s .......................................................................................................... 691 18.1.5 broadcast comm unicati on ....................................................................................................... 6 92 18.1.6 transfer format of iebus ....................................................................................................... .. 692 18.1.7 transfer data .................................................................................................................. ......... 702 18.1.8 bit fo rmat ..................................................................................................................... ............ 704 18.2 configuration .................................................................................................................. .......705 18.3 registers ...................................................................................................................... ..........707 18.4 interrupt operations of iebus cont roller............................................................................736 18.4.1 interrupt cont rol bl ock ........................................................................................................ ...... 736 18.4.2 example of ident ifying in terrupt ............................................................................................... 739 18.4.3 interrupt s ource list .......................................................................................................... ........ 742 18.4.4 communication error sour ce processi ng list ............................................................................ 743 18.5 interrupt request signal generation timing and main cpu processing........................745 18.5.1 master tr ansmissi on ............................................................................................................ .... 745 18.5.2 master re ceptio n............................................................................................................... ....... 747 18.5.3 slave trans missi on ............................................................................................................. ..... 749 18.5.4 slave rec eptio n................................................................................................................ ........ 751 18.5.5 interval of occurrence of interrupt request signal for iebus cont rol ......................................... 753 chapter 19 can controller ......................................... ......................................................... ....757 19.1 overview....................................................................................................................... ..........757 19.1.1 featur es ....................................................................................................................... ........... 757 19.1.2 overview of func tions .......................................................................................................... .... 758 19.1.3 configur ation .................................................................................................................. ......... 759 19.2 can protocol ................................................................................................................... ......760 19.2.1 frame fo rmat ................................................................................................................... ........ 760 19.2.2 frame types .................................................................................................................... ........ 761 19.2.3 data frame and re mote frame.................................................................................................. 76 1 19.2.4 error fr ame .................................................................................................................... .......... 768 19.2.5 overload frame................................................................................................................. ....... 769 19.3 functions ...................................................................................................................... .........770 19.3.1 determining bus prio rity....................................................................................................... .... 770 19.3.2 bit stu ffing................................................................................................................... ............. 770 19.3.3 multi ma sters .................................................................................................................. ......... 770 19.3.4 multi cast ..................................................................................................................... ............ 770 19.3.5 can sleep mode/can st op mode func tion .............................................................................. 771 19.3.6 error contro l func tion ......................................................................................................... ...... 771 19.3.7 baud rate cont rol func tion..................................................................................................... ... 778 19.4 connection with target system ................................. .........................................................782 19.5 internal registers of can controller ..................................................................................783
user?s manual u16603ej5v1ud 16 19.5.1 can controller c onfigurat ion ................................................................................................... .783 19.5.2 register a ccess ty pe ........................................................................................................... ....784 19.5.3 register bit c onfigurat ion ..................................................................................................... ....818 19.6 registers ...................................................................................................................... ......... 822 19.7 bit set/clear function ......................................................................................................... . 857 19.8 can controller initializat ion................................................................................................ 85 9 19.8.1 initialization of can m odule................................................................................................... ..859 19.8.2 initialization of message buffer ............................................................................................... .859 19.8.3 redefinition of message bu ffer ................................................................................................8 59 19.8.4 transition from initializati on mode to operat ion m ode.............................................................. 861 19.8.5 resetting error counter cn erc of can module ......................................................................861 19.9 message reception .............................................................................................................. 862 19.9.1 message rec eptio n .............................................................................................................. ....862 19.9.2 reading recept ion dat a......................................................................................................... ...863 19.9.3 receive history list func tion .................................................................................................. ...864 19.9.4 mask func tion.................................................................................................................. .........866 19.9.5 multi buffer receiv e block f uncti on............................................................................................ 868 19.9.6 remote frame recept ion ......................................................................................................... .869 19.10 message transmission ........................................................................................................ 870 19.10.1 message trans missi on ........................................................................................................... ..870 19.10.2 transmit history list func tion ................................................................................................. ...872 19.10.3 automatic block tr ansmission ( abt) ........................................................................................874 19.10.4 transmission abor t proc ess..................................................................................................... 875 19.10.5 remote frame transmissi on .....................................................................................................8 76 19.11 power saving modes............................................................................................................ 8 77 19.11.1 can sleep mode................................................................................................................. .....877 19.11.2 can stop mode .................................................................................................................. .....879 19.11.3 example of using pow er saving modes ....................................................................................880 19.12 interrupt function............................................................................................................. .... 881 19.13 diagnosis functions and special operational mode s ..................................................... 882 19.13.1 receive-onl y m ode .............................................................................................................. ....882 19.13.2 single-shot mode............................................................................................................... ......883 19.13.3 self-tes t mode................................................................................................................. .........884 19.13.4 transmission/reception operati on in each operat ion m ode...................................................... 885 19.14 time stamp function ........................................................................................................... 8 86 19.14.1 time stamp functi on ............................................................................................................ ....886 19.15 baud rate settings............................................................................................................. .. 888 19.15.1 bit rate setti ng condi tions.................................................................................................... .....888 19.15.2 representative examples of baud rate settings .......................................................................892 19.16 operation of can contro ller ............................................................................................... 896 chapter 20 dma function (dma controller) ..... .............................................................. 922 20.1 features....................................................................................................................... .......... 922 20.2 configuration .................................................................................................................. ...... 923 20.3 registers ...................................................................................................................... ......... 924 20.4 transfer targets ............................................................................................................... .... 933 20.5 transfer modes ................................................................................................................. .... 933 20.6 transfer types ................................................................................................................. ..... 934
user?s manual u16603ej5v1ud 17 20.7 dma channel priorities ........................................................................................................9 35 20.8 time related to dma transfer.............................................................................................935 20.9 dma transfer start factors ............. ....................................................................................936 20.10 dma abort factors.............................................................................................................. ..937 20.11 end of dma transfer............................................................................................................ .937 20.12 operation timing............................................................................................................... ....937 20.13 cautions ....................................................................................................................... ..........942 chapter 21 crc functio n .................................................................................................... ........946 21.1 functions ...................................................................................................................... .........946 21.2 configuration .................................................................................................................. .......946 21.3 registers ...................................................................................................................... ..........947 21.4 operation...................................................................................................................... ..........948 21.5 usage.......................................................................................................................... ............949 chapter 22 interrupt/exception processing fu nction ...............................................951 22.1 features....................................................................................................................... ...........951 22.2 non-maskable interrupts .......................... ............................................................................95 6 22.2.1 operat ion...................................................................................................................... ........... 958 22.2.2 restore........................................................................................................................ ............ 959 22.2.3 np fl ag........................................................................................................................ ............. 960 22.3 maskable interrupts ............................................................................................................ ..961 22.3.1 operat ion...................................................................................................................... ........... 961 22.3.2 restore........................................................................................................................ ............ 963 22.3.3 priorities of ma skable inte rrupts .............................................................................................. 964 22.3.4 interrupt control r egister ( xxicn) ............................................................................................. . 968 22.3.5 interrupt mask registers 0 to 4 (imr0 to imr4 )........................................................................ 972 22.3.6 in-service priority register (ispr)............................................................................................ . 974 22.3.7 id flag ........................................................................................................................ .............. 975 22.3.8 watchdog timer mode regi ster 2 (w dtm2) ............................................................................. 975 22.4 software exception ............................................................................................................. ..976 22.4.1 operat ion...................................................................................................................... ........... 976 22.4.2 restore........................................................................................................................ ............ 977 22.4.3 ep fl ag........................................................................................................................ ............. 978 22.5 exception trap ................................................................................................................. .....979 22.5.1 illegal opcode definit ion ...................................................................................................... ..... 979 22.5.2 debug tr ap..................................................................................................................... .......... 981 22.6 external interrupt request input pins (nmi and intp0 to intp8) ....................................983 22.6.1 noise elim inatio n .............................................................................................................. ....... 983 22.6.2 edge detec tion................................................................................................................. ........ 983 22.7 interrupt acknowledge time of cpu ...................................................................................989 22.8 periods in which interrupts are not acknowledged by cpu...........................................992 22.9 cautions ....................................................................................................................... ..........992 chapter 23 key interrupt function ......................... .............................................................993 23.1 function ....................................................................................................................... ..........993
user?s manual u16603ej5v1ud 18 23.2 register ....................................................................................................................... .......... 994 23.3 cautions ....................................................................................................................... ......... 994 chapter 24 standby function ................................................................................................ .. 995 24.1 overview....................................................................................................................... ......... 995 24.2 registers ...................................................................................................................... ......... 997 24.3 halt mode...................................................................................................................... .... 1000 24.3.1 setting and operati on stat us ..................................................................................................1 000 24.3.2 releasing ha lt m ode...........................................................................................................1 000 24.4 idle1 mode ..................................................................................................................... .... 1002 24.4.1 setting and operati on stat us ..................................................................................................1 002 24.4.2 releasing id le1 m ode ..........................................................................................................1 003 24.5 idle2 mode ..................................................................................................................... .... 1005 24.5.1 setting and operati on stat us ..................................................................................................1 005 24.5.2 releasing id le2 m ode ..........................................................................................................1 005 24.5.3 securing setup time when releasing id le2 m ode ................................................................. 1007 24.6 stop mode...................................................................................................................... .... 1008 24.6.1 setting and operati on stat us ..................................................................................................1 008 24.6.2 releasing st op m ode .......................................................................................................... 10 08 24.6.3 securing oscillation stabilization ti me when releasi ng stop mode .......................................1011 24.7 subclock operation mode ................................................................................................. 1012 24.7.1 setting and operati on stat us ..................................................................................................1 012 24.7.2 releasing subclock operation mode ......................................................................................1012 24.8 sub-idle mode .................................................................................................................. . 1014 24.8.1 setting and operati on stat us ..................................................................................................1 014 24.8.2 releasing sub- idle m ode ..................................................................................................... 101 5 chapter 25 reset functions ................................................................................................. .. 1017 25.1 overview....................................................................................................................... ....... 1017 25.2 registers to check reset source.................................. ................................................... 1019 25.3 operation...................................................................................................................... ....... 1020 25.3.1 reset operation vi a reset pin .............................................................................................1020 25.3.2 reset operation by watc hdog timer 2 (w dt2res) ................................................................1022 25.3.3 reset operation by low-voltage detec tor (lvires) (v 850es/sj2 only) .................................1024 25.3.4 reset operation by clo ck monitor (c lmres) ........................................................................1025 25.3.5 operation after re set rel ease .................................................................................................1 027 25.3.6 reset function oper ation fl ow.................................................................................................1 029 25.4 valid/invalid of internal ram data ............................ ........................................................ 1030 chapter 26 clock monitor ................................................................................................... ... 1031 26.1 functions...................................................................................................................... ....... 1031 26.2 configuration .................................................................................................................. .... 1031 26.3 register ....................................................................................................................... ........ 1032 26.4 operation...................................................................................................................... ....... 1033 chapter 27 low-voltage detector ............................. ........................................................ 1036
user?s manual u16603ej5v1ud 19 27.1 functions ...................................................................................................................... .......1036 27.2 configuration .................................................................................................................. .....1036 27.3 registers ...................................................................................................................... ........1037 27.4 operation...................................................................................................................... ........1039 27.4.1 to use for internal re set signal (l vires) .............................................................................. 1039 27.4.2 to use for inte rrupt (intlvi).................................................................................................. 1040 27.5 ram retention voltage detection operat ion (provided to both v850es/sj2 and v850es/sj2-h) .................................................................................................................. ...1041 27.6 emulation function (provided to both v850es/s j2 and v850es/sj2-h) .....................1042 chapter 28 regulator ........................................................................................................ ........1043 28.1 outline ........................................................................................................................ ..........1043 28.2 operation...................................................................................................................... ........1044 chapter 29 rom correction function .................... ...........................................................1045 29.1 overview....................................................................................................................... ........1045 29.2 registers ...................................................................................................................... ........1046 29.3 rom correction operation and program flow ......... .......................................................1047 29.4 cautions ....................................................................................................................... ........1049 chapter 30 flash memory.................................................................................................... .....1050 30.1 features....................................................................................................................... .........1050 30.2 memory configuration ................................. .......................................................................105 1 30.3 functional outline............................................................................................................. ..1054 30.4 rewriting by dedicated flash memory programmer .......................................................1057 30.4.1 programming env ironment .................................................................................................... 1057 30.4.2 communicati on mode ............................................................................................................ 1 058 30.4.3 flash memory cont rol ........................................................................................................... . 1065 30.4.4 selection of comm unication mode ......................................................................................... 1066 30.4.5 communication commands ................................................................................................... 1067 30.4.6 pin connec tion ................................................................................................................. ...... 1068 30.5 rewriting by self programming............... ..........................................................................1072 30.5.1 overvi ew ....................................................................................................................... ........ 1072 30.5.2 featur es ....................................................................................................................... ......... 1073 30.5.3 standard self progr amming fl ow ............................................................................................ 1074 30.5.4 flash f uncti ons ................................................................................................................ ...... 1075 30.5.5 pin proc essi ng ................................................................................................................. ...... 1075 30.5.6 internal res ources used ........................................................................................................ . 1076 chapter 31 on-chip debug function....................... .............................................................1077 31.1 features....................................................................................................................... .........1077 31.2 connection circuit example ....................................... .......................................................1078 31.3 interface signals.............................................................................................................. ....1078 31.4 register ....................................................................................................................... .........1080 31.5 operation...................................................................................................................... ........1082 31.6 rom security function.......................................................................................................108 3
user?s manual u16603ej5v1ud 20 31.6.1 security id .................................................................................................................... .........1083 31.6.2 setti ng ........................................................................................................................ ...........1084 31.7 cautions ....................................................................................................................... ....... 1086 chapter 32 electrical specifications ....................... ........................................................ 1087 32.1 absolute maximum ratings .............................................................................................. 1087 32.2 capacitance.................................................................................................................... ..... 1089 32.3 operating conditions......................................................................................................... 10 89 32.4 oscillator characteristi cs .................................................................................................. 109 0 32.4.1 main clock oscillator characteri stics .......................................................................................109 0 32.4.2 subclock oscillator c haracterist ics .........................................................................................109 3 32.4.3 pll characte ristics ............................................................................................................ ....1094 32.4.4 internal oscillator characteri stics............................................................................................ 1094 32.5 regulator characteristi cs.................................................................................................. 1095 32.6 dc characteristics ............................................................................................................. 1096 32.6.1 i/o level ...................................................................................................................... ...........1096 32.6.2 supply cu rrent................................................................................................................. .......1098 32.7 data retention characteristics . ........................................................................................ 1100 32.8 ac characteristics ............................................................................................................. 1101 32.8.1 clkout output timi ng........................................................................................................... 1102 32.8.2 bus ti ming ..................................................................................................................... .........1102 32.9 basic operation ................................................................................................................ .. 1116 32.10 flash memory programming characteristics............ ...................................................... 1125 chapter 33 package drawing ................................................................................................ 1 128 chapter 34 recommended soldering conditions. ........................................................ 1129 appendix a development tools............................................................................................. 11 30 a.1 software package ............................................................................................................... 1135 a.2 language processing software ........................................................................................ 1135 a.3 control software............................................................................................................... .. 1135 a.4 debugging tools (hardware) .......................................... .................................................. 1136 a.4.1 when using in-circuit em ulator ie-v 850es-g1 ...................................................................... 1136 a.4.2 when using iecu be qb-v850 essx2 .................................................................................. 1138 a.4.3 when using on-chip debug emul ator ie-v850e 1-cd-nw ......................................................1140 a.4.4 when using minicu be qb-v850m ini ..................................................................................1141 a.5 debugging tools (software).............................................................................................. 1142 a.6 embedded software ........................................................................................................... 114 3 a.7 flash memory writing tools ............................................................................................. 1143 appendix b major differences between v850es/sj2 and v850es/sj2-h............... 1144 appendix c register index .................................................................................................. ..... 1146
user?s manual u16603ej5v1ud 21 appendix d instruction set list........................................................................................... .1162 d.1 conventions.................................................................................................................... .....1162 d.2 instruction set (in alphabetical order) .................. ...........................................................1165 appendix e revision history ................................................................................................ ....1172 e.1 major revisions in this edition ................................. ........................................................1172 e.2 revision history of previous editions ................... ...........................................................1182
user?s manual u16603ej5v1ud 22 chapter 1 introduction the v850es/sj2 and v850es/sj2-h are products in t he nec electronics v850 single-chip microcontrollers designed for low-power operation for real-time control applications. 1.1 general the v850es/sj2 and v850es/sj2-h are 32-bit single-chip microcontrollers that include the v850es cpu core and peripheral functions such as rom/ram, a timer/counter, se rial interfaces, an a/d converter, and a d/a converter. some models of the v850es/sj2 and v 850es/sj2-h are provided with iebus tm (inter equipment bus tm ) or can (controller area network) as an automotive lan. in addition to high real-time response characteristics and 1-clock-pitch basic instructions, the v850es/sj2 and v850es/sj2-h feature multiply instruct ions, saturated operation instructions , bit manipulation instructions, etc., realized by a hardware multiplier, as optimum instructions for digital servo control applications. moreover, as a real- time control system, the v850es/sj2 an d v850es/sj2-h enable an extremely high cost-performance for applications that require a low power consumption, such as audio and car audio. table 1-1 lists the products of the v850es/sj2 and v850es/sj2-h. models of the v850es/sj2 and v850es/ sj2-h with simplified i/o, timer/counter, and serial interface functions, v850es/sg2 and v850es/sg2-h, are also available. see table 1-2 v850es/sg2, v850es/sg2-h product list .
chapter 1 introduction user?s manual u16603ej5v1ud 23 table 1-1. v850es/sj2, v850es/sj2-h product list rom maskable interrupts function part number type size ram size operating frequency (max.) i 2 c iebus can external internal non-maskable interrupts pd703264 none pd703264y mask rom on-chip pd70f3264 none pd70f3264y flash memory 384 kb 32 kb on-chip pd703265 none pd703265y 20 mhz 60 pd703265hy 512 kb 40 kb 32 mhz on-chip 59 pd703266 none pd703266y 20 mhz 60 pd703266hy mask rom 32 mhz on-chip 59 pd70f3266 none pd70f3266y 20 mhz 60 pd70f3266hy flash memory 640 kb 48 kb 32 mhz on-chip none 59 pd703274 none pd703274y mask rom on-chip pd70f3274 none pd70f3274y flash memory 384 kb 32 kb on-chip pd703275 none pd703275y 20 mhz 64 pd703275hy 512 kb 40 kb 32 mhz on-chip 63 pd703276 none pd703276y 20 mhz 64 pd703276hy mask rom 32 mhz on-chip 63 pd70f3276 none pd70f3276y 20 mhz 64 pd70f3276hy flash memory 640 kb 48 kb 32 mhz on-chip on-chip none 63 pd703284 none pd703284y mask rom on-chip pd70f3284 none pd70f3284y flash memory 384 kb 32 kb on-chip pd703285 none pd703285y 20 mhz 64 pd703285hy 512 kb 40 kb 32 mhz on-chip 63 pd703286 none pd703286y 20 mhz 64 pd703286hy mask rom 32 mhz on-chip 63 pd70f3286 none pd70f3286y 20 mhz 64 pd70f3286hy flash memory 640 kb 48 kb 32 mhz on-chip 1 ch 63 pd703287 none pd703287y 20 mhz 68 pd703287hy 512 kb 40 kb 32 mhz on-chip 67 pd703288 none pd703288y 20 mhz 68 pd703288hy mask rom 32 mhz on-chip 67 pd70f3288 none pd70f3288y 20 mhz 68 pd70f3288hy flash memory 640 kb 48 kb 32 mhz on-chip none 2 ch 9 67 2 remark the part numbers of the v850es/sj2 and v850es/sj 2-h are shown as follows in this manual.
chapter 1 introduction user?s manual u16603ej5v1ud 24 ? v850es/sj2 pd703264, 703264y, 703265, 703265y, 703266, 703266y, 703274, 703274y, 703275, 703275y, 703276, 703276y, 703284, 703284y, 703285, 703285y, 703286, 703286y, 703287, 703287y, 703288, 703288y, 70f3264, 70f3264y, 70f3266, 70f3266 y, 70f3274, 70f3274y, 70f3276, 70f3276y, 70f3284, 70f3284y, 70f3286, 70f3286y, 70f3288, 70f3288y ? v850es/sj2-h pd703265hy, 703266hy, 70f3266hy, 703275hy, 703276hy, 70f3276hy, 703285hy, 703286hy, 703287hy, 703288hy, 70f3286hy, 70f3288hy ? mask rom versions pd703264, 703264y, 703265, 703265y, 703265hy, 703266, 703266y, 703266hy, 703274, 703274y, 703275, 703275y, 703275hy, 703276, 703276y, 703276hy, 703284, 703284y, 703285, 703285y, 703285hy, 703286, 703286y, 703286hy, 703287, 703287y, 703287hy, 703288, 703288y, 703288hy ? flash memory versions pd70f3264, 70f3264y, 70f3266, 70f3266y, 70f3266hy, 70f3274, 70f3274y, 70f3276, 70f3276y, 70f3276hy, 70f3284, 70f3284y, 70f3286, 70f3286y, 70f3286hy, 70f3288, 70f3288y, 70f3288hy ? i 2 c bus versions (y products): all v850es/sj2-h products have an on-chip i 2 c bus. pd703264y, 703265y, 703265hy, 703266y, 703266hy, 703274y, 703275y, 703275hy, 703276y, 703276hy, 703284y, 703285y, 703285hy, 703286y, 703286hy, 703287y, 703287hy, 703288y, 703288hy, 70f3264y, 70f3266y, 70f3266hy, 70f3274y, 70f3276y, 70f3276 hy, 70f3284y, 70f3286y, 70f3286hy, 70f3288y, 70f3288hy ? general-purpose versions pd703264, 703264y, 703265, 703265y, 703265hy, 703266, 703266y, 703266hy, 70f3264, 70f3264y, 70f3266, 70f3266y, 70f3266hy ? iebus controller versions pd703274, 703274y, 703275, 703275y, 703275hy, 703276, 703276y, 703276hy, 70f3274, 70f3274y, 70f3276, 70f3276y, 70f3276hy ? can controller versions pd703284, 703284y, 703285, 703285y, 703285hy, 703286, 703286y, 703286hy, 70f3284, 70f3284y, 70f3286, 70f3286y, 70f3286hy, 703287, 703287y, 7 03287hy, 703288, 703288y, 703288hy, 70f3288, 70f3288y, 70f3288hy ? can controller (2-channel) versions pd703287, 703287y, 703287hy, 703288, 703288y , 703288hy, 70f3288, 70f3288y, 70f3288hy
chapter 1 introduction user?s manual u16603ej5v1ud 25 table 1-2. v850es/sg2, v850es/sg2-h product list rom maskable interrupts function part number type size ram size operating frequency (max.) i 2 c iebus can external internal non-maskable interrupts pd703260 none pd703260y 256 kb 24 kb on-chip pd703261 none pd703261y mask rom on-chip pd70f3261 none pd70f3261y flash memory 384 kb 32 kb on-chip pd703262 none pd703262y 20 mhz 47 pd703262hy 512 kb 40 kb 32 mhz on-chip 46 pd703263 none pd703263y 20 mhz 47 pd703263hy mask rom 32 mhz on-chip 46 pd70f3263 none pd70f3263y 20 mhz 47 pd70f3263hy flash memory 640 kb 48 kb 32 mhz on-chip none 46 pd703270 none pd703270y 256 kb 24 kb on-chip pd703271 none pd703271y mask rom on-chip pd70f3271 none pd70f3271y flash memory 384 kb 32 kb on-chip pd703272 none pd703272y 20 mhz 51 pd703272hy 512 kb 40 kb 32 mhz on-chip 50 pd703273 none pd703273y 20 mhz 51 pd703273hy mask rom 32 mhz on-chip 50 pd70f3273 none pd70f3273y 20 mhz 51 pd70f3273hy flash memory 640 kb 48 kb 32 mhz on-chip on-chip none 50 pd703280 none pd703280y 256 kb 24 kb on-chip pd703281 none pd703281y mask rom on-chip pd70f3281 none pd70f3281y flash memory 384 kb 32 kb on-chip pd703282 none pd703282y 20 mhz 51 pd703282hy 512 kb 40 kb 32 mhz on-chip 50 pd703283 none pd703283y 20 mhz 51 pd703283hy mask rom 32 mhz on-chip 50 pd70f3283 none pd70f3283y 20 mhz 51 pd70f3283hy flash memory 640 kb 48 kb 32 mhz on-chip none on-chip 8 50 2
chapter 1 introduction user?s manual u16603ej5v1ud 26 1.2 features { minimum instruction execution time: v850es/sj2: 50 ns (operating with main clock (f xx ) = 20 mhz) v850es/sj2-h: 31.25 ns (operating with main clock (f xx ) = 32 mhz) { general-purpose registers: 32 bits 32 registers { cpu features: signed multiplication (16 16 32): 1 to 2 clocks signed multiplication (32 32 64): 1 to 5 clocks saturated operations (overflow and underflow detection functions included) 32-bit shift instruction: 1 clock bit manipulation instructions load/store instructions with long/short format { memory space: 64 mb of linear address space (for programs and data) external expansion: up to 16 mb ? internal memory: ram: 32/40/48 kb (see table 1-1 ) mask rom: 384/512/640 kb (see table 1-1 ) flash memory: 384/640 kb (see table 1-1 ) ? external bus interface: separate bus/multiplexed bus output selectable 8/16 bit data bus sizing function wait function ? programmable wait function ? external wait function idle state function bus hold function { interrupts and exceptions: non-maskable interrupts: 2 sources maskable interrupts: 59/ 60/63/64/67/68 sources (see table 1-1 ) software exceptions: 32 sources exception trap: 2 sources { i/o lines: i/o ports: 128 { timer function: 16-bit interv al timer m (tmm): 1 channel 16-bit timer/event counter p (tmp): 9 channels 16-bit timer/event counter q (tmq): 1 channel watch timer: 1 channel watchdog timer: 1 channel { real-time output port: 6 bits 2 channels { serial interface: asynchronous serial interface a (uarta) 3-wire variable-length serial interface b (csib) i 2 c bus interface (i 2 c) (i 2 c bus versions (y products) only) uarta/csib: 1 channel uarta/i 2 c: 2 channels csib/i 2 c: 1 channel csib: 4 channels uarta: 1 channel { iebus controller: 1 channel (iebus controller versions only) { can controller: 1 channel/2 channels (can controller versions only) { a/d converter: 10-bit resolution: 16 channels { d/a converter: 8-bit resolution: 2 channels { dma controller: 4 channels
chapter 1 introduction user?s manual u16603ej5v1ud 27 { crc function: 16-bit error detection codes are generated for data in 8-bit units { on-chip debug function: jtag interface (flash memory version only) { rom correction: 4 correct ion addresses specifiable { clock generator: during main clock or subclock operation 7-level cpu clock (f xx , f xx /2, f xx /4, f xx /8, f xx /16, f xx /32, f xt ) clock-through mode/pll mode selectable { internal oscillation clock: 200 khz (typ.) { power-save functions: halt/idle1/idle2/stop/subclock/sub-idle mode { package: 144-pin plastic lqfp (fine pitch) (20 20) 1.3 application fields audio, car audio, consumer devices
chapter 1 introduction user?s manual u16603ej5v1ud 28 1.4 ordering information (1) v850es/sj2 part number package internal rom pd703264gj-xxx-uen-a pd703264ygj-xxx-uen-a pd703265gj-xxx-uen-a pd703265ygj-xxx-uen-a pd703266gj-xxx-uen-a pd703266ygj-xxx-uen-a pd703274gj-xxx-uen-a pd703274ygj-xxx-uen-a pd703275gj-xxx-uen-a pd703275ygj-xxx-uen-a pd703276gj-xxx-uen-a pd703276ygj-xxx-uen-a pd703284gj-xxx-uen-a pd703284ygj-xxx-uen-a pd703285gj-xxx-uen-a pd703285ygj-xxx-uen-a pd703286gj-xxx-uen-a pd703286ygj-xxx-uen-a pd703287gj-xxx-uen-a pd703287ygj-xxx-uen-a pd703288gj-xxx-uen-a pd703288ygj-xxx-uen-a pd70f3264gj-uen-a pd70f3264ygj-uen-a pd70f3266gj-uen-a pd70f3266ygj-uen-a pd70f3274gj-uen-a pd70f3274ygj-uen-a pd70f3276gj-uen-a pd70f3276ygj-uen-a pd70f3284gj-uen-a pd70f3284ygj-uen-a pd70f3286gj-uen-a pd70f3286ygj-uen-a pd70f3288gj-uen-a pd70f3288ygj-uen-a 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 384 kb (mask rom) 384 kb (mask rom) 512 kb (mask rom) 512 kb (mask rom) 640 kb (mask rom) 640 kb (mask rom) 384 kb (mask rom) 384 kb (mask rom) 512 kb (mask rom) 512 kb (mask rom) 640 kb (mask rom) 640 kb (mask rom) 384 kb (mask rom) 384 kb (mask rom) 512 kb (mask rom) 512 kb (mask rom) 640 kb (mask rom) 640 kb (mask rom) 512 kb (mask rom) 512 kb (mask rom) 640 kb (mask rom) 640 kb (mask rom) 384 kb (flash memory) 384 kb (flash memory) 640 kb (flash memory) 640 kb (flash memory) 384 kb (flash memory) 384 kb (flash memory) 640 kb (flash memory) 640 kb (flash memory) 384 kb (flash memory) 384 kb (flash memory) 640 kb (flash memory) 640 kb (flash memory) 640 kb (flash memory) 640 kb (flash memory) remarks 1. xxx indicates rom code suffix. 2. v850es/sj2 microcontrollers are lead-free products.
chapter 1 introduction user?s manual u16603ej5v1ud 29 (2) v850es/sj2-h part number package internal rom pd703265hygj-xxx-uen-a pd703266hygj-xxx-uen-a pd70f3266hygj-uen-a pd703275hygj-xxx-uen-a pd703276hygj-xxx-uen-a pd70f3276hygj-uen-a pd703285hygj-xxx-uen-a pd703286hygj-xxx-uen-a pd703287hygj-xxx-uen-a pd703288hygj-xxx-uen-a pd70f3286hygj-uen-a pd70f3288hygj-uen-a 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 512 kb (mask rom) 640 kb (mask rom) 640 kb (flash memory) 512 kb (mask rom) 640 kb (mask rom) 640 kb (flash memory) 512 kb (mask rom) 640 kb (mask rom) 512 kb (mask rom) 640 kb (mask rom) 640 kb (flash memory) 640 kb (flash memory) remarks 1. xxx indicates rom code suffix. 2. v850es/sj2 microcontrollers are lead-free products.
chapter 1 introduction user?s manual u16603ej5v1ud 30 1.5 pin configuration (top view) 144-pin plastic lqfp (fine pitch) (20 20) ? v850es/sj2 pd703264gj-xxx-uen-a pd703275gj-xxx-uen-a pd703286gj-xxx-uen-a pd703264ygj-xxx-uen-a pd703275ygj-xxx-uen-a pd703286ygj-xxx-uen-a pd703265gj-xxx-uen-a pd703276gj-xxx-uen-a pd703287gj-xxx-uen-a pd703265ygj-xxx-uen-a pd703276ygj-xxx-uen-a pd703287ygj-xxx-uen-a pd703266gj-xxx-uen-a pd70f3274gj-uen-a pd703288gj-xxx-uen-a pd703266ygj-xxx-uen-a pd70f3274ygj-uen-a pd703288ygj-xxx-uen-a pd70f3264gj-uen-a pd70f3276gj-uen-a pd70f3284gj-uen-a pd70f3264ygj-uen-a pd70f3276ygj-uen-a pd70f3284ygj-uen-a pd70f3266gj-uen-a pd703284gj-xxx-uen-a pd70f3286gj-uen-a pd70f3266ygj-uen-a pd703284ygj-xxx-uen-a pd70f3286ygj-uen-a pd703274gj-xxx-uen-a pd703285gj-xxx-uen-a pd70f3288gj-uen-a pd703274ygj-xxx-uen-a pd703285ygj-xxx-uen-a pd70f3288ygj-uen-a ? v850es/sj2-h pd703265hygj-xxx-uen-a pd703276hygj-xxx-uen-a pd703287hygj-xxx-uen-a pd703266hygj-xxx-uen-a pd70f3276hygj-uen-a pd703288hygj-xxx-uen-a pd70f3266hygj-uen-a pd703285hygj-xxx-uen-a pd70f3286hygj-uen-a pd703275hygj-xxx-uen-a pd703286hygj-xxx-uen-a pd70f3288hygj-uen-a
chapter 1 introduction user?s manual u16603ej5v1ud 31 pdl3/ad3 pdl2/ad2 pdl1/ad1 pdl0/ad0 bv dd bv ss pct7 pct6/astb pct5 pct4/rd pct3 pct2 pct1/wr1 pct0/wr0 pcs7 pcs6 pcs5 pcs4 pcm5 pcm4 pcm3/hldrq pcm2/hldak pcm1/clkout pcm0/wait pcs3/cs3 pcs2/cs2 pcs1/cs1 pcs0/cs0 pcd3 pcd2 pcd1 pcd0 p915/a15 note 9 /intp6/tip50/top50 p914/a14 note 9 /intp5/tip51/top51 p913/a13 note 9 /intp4 p912/a12 note 9 /sckb3 av ref0 av ss p10/ano0 p11/ano1 av ref1 p00/tip61/top61 p01/tip60/top60 ic note 1 /flmd0 note 1 v dd regc note 2 v ss x1 x2 reset xt1 xt2 p02/nmi p03/intp0/adtrg p04/intp1 p05/intp2/drst notes 3, 4 p06/intp3 p40/sib0/sda01 note 5 p41/sob0/scl01 note 5 p42/sckb0 p30/txda0/sob4 p31/rxda0/intp7/sib4 p32/ascka0/sckb4/tip00/top00 p33/tip01/top01/ctxd1 note 6 p34/tip10/top10/crxd1 note 6 p35/tip11/top11 p36/ietx0 note 7 /ctxd0 note 8 p37/ierx0 note 7 /crxd0 note 8 ev ss ev dd p38/txda2/sda00 note 5 p39/rxda2/scl00 note 5 p50/tiq01/kr0/toq01/rtp00 p51/tiq02/kr1/toq02/rtp01 p52/tiq03/kr2/toq03/rtp02/ddi note 3 p53/sib2/kr3/tiq00/toq00/rtp03/ddo note 3 p54/sob2/kr4/rtp04/dck note 3 p55/sckb2/kr5/rtp05/dms note 3 p60/rtp10 p61/rtp11 p62/rtp12 p63/rtp13 p64/rtp14 p65/rtp15 p66/sib5 p67/sob5 p68/sckb5 p69/tip70/top70 p610/tip71 p611/top71 p612/tip80/top80 p613/tip81/top81 p614 p615 p80/rxda3/intp8 p81/txda3 p90/a0 note 9 /kr6/txda1/sda02 note 5 p91/a1 note 9 /kr7/rxda1/scl02 note 5 p92/a2 note 9 /tip41/top41 p93/a3 note 9 /tip40/top40 p94/a4 note 9 /tip31/top31 p95/a5 note 9 /tip30/top30 p96/a6 note 9 /tip21/top21 p97/a7 note 9 /sib1/tip20/top20 p98/a8 note 9 /sob1 p99/a9 note 9 /sckb1 p910/a10 note 9 /sib3 p911a11 note 9 /sob3 p70/ani0 note 10 p71/ani1 note 10 p72/ani2 note 10 p73/ani3 note 10 p74/ani4 note 10 p75/ani5 note 10 p76/ani6 note 10 p77/ani7 note 10 p78/ani8 note 10 p79/ani9 note 10 p710/ani10 note 10 p711/ani11 note 10 p712/ani12 note 10 p713/ani13 note 10 p714/ani14 note 10 p715/ani15 note 10 pdh7/a23 pdh6/a22 pdh5/a21 pdh4/a20 pdh3/a19 pdh2/a18 pdh1/a17 pdh0/a16 pdl15/ad15 pdl14/ad14 pdl13/ad13 pdl12/ad12 pdl11/ad11 pdl10/ad10 pdl9/ad9 pdl8/ad8 pdl7/ad7 pdl6/ad6 pdl5/ad5/flmd1 note 1 pdl4/ad4 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 notes 1. ic: directly connect this pin to v ss (mask rom version only). flmd0: connect these pins to v ss in the normal mode (flash memory version only). flmd1: flash memory version only 2. connect the regc pin to v ss via a 4.7 f capacitor. 3. the drst, ddi, ddo, dck, and dms pins are valid only in the flash memory version. 4. fix this pin to the low level from when the rese t status has been released until the ocdm.ocdm0 bit is cleared (0) when the on-chip debug func tion is not used. for details, see 4.6.3 cautions on on-chip debug pins . 5. the scl00 to scl02 and sda00 to sda02 pins are valid only in the i 2 c bus version (y product). 6. the ctxd1 and crxd1 pins are valid only in the can controller (2-channel) version. 7. the ietx0 and ierx0 pins are valid only in the iebus controller version. 8. the ctxd0 and crxd0 pins are vali d only in the can controller version. 9. port 9 cannot be used as port pins or other alternat e-function pins when the a0 to a15 pins are used in the separate bus mode. 10. to use port 7 (p70/ani0 to p715/ani15) as a/d conv erter function pins and port i/o pins in mix, be sure to observe usage cautions (see 13.6 (4) alternate i/o ).
chapter 1 introduction user?s manual u16603ej5v1ud 32 pin names a0 to a23: ad0 to ad15: adtrg: ani0 to ani15: ano0, ano1: ascka0: astb: av ref0 , av ref1 : av ss : bv dd : bv ss : clkout: crxd0, crxd1: cs0 to cs3: ctxd0, ctxd1: dck: ddi: ddo: dms: drst: ev dd : ev ss : flmd0, flmd1: hldak: hldrq: ic: ierx0: ietx0: intp0 to intp8: kr0 to kr7: nmi: p00 to p06: p10, p11: p30 to p39: p40 to p42: p50 to p55: p60 to p615: p70 to p715: p80, p81: p90 to p915: pcd0 to pcd3: pcm0 to pcm5: pcs0 to pcs7: address bus address/data bus a/d trigger input analog input analog output asynchronous serial clock address strobe analog reference voltage analog v ss power supply for bus interface ground for bus interface clock output can receive data chip select can transmit data debug clock debug data input debug data output debug mode select debug reset power supply for port ground for port flash programming mode hold acknowledge hold request internally connected iebus receive data iebus transmit data external interrupt input key return non-maskable interrupt request port 0 port 1 port 3 port 4 port 5 port 6 port 7 port 8 port 9 port cd port cm port cs pct0 to pct7: pdh0 to pdh7: pdl0 to pdl15: rd: regc: reset: rtp00 to rtp05, rtp10 to rtp15: rxda0 to rxda3: sckb0 to sckb5: scl00 to scl02: sda00 to sda02: sib0 to sib5: sob0 to sob5: tip00, tip01, tip10, tip11, tip20, tip21, tip30, tip31, tip40, tip41, tip50, tip51, tip60, tip61, tip70, tip71, tip80, tip81, tiq00 to tiq03: top00, top01, top10, top11, top20, top21, top30, top31, top40, top41, top50, top51, top60, top61, top70, top71, top80, top81, toq00 to toq03: txda0 to txda3: v dd: v ss: wait: wr0: wr1: x1, x2: xt1, xt2: port ct port dh port dl read strobe regulator control reset real-time output port receive data serial clock serial clock serial data serial input serial output timer input timer output transmit data power supply ground wait lower byte write strobe upper byte write strobe crystal for main clock crystal for subclock
chapter 1 introduction user?s manual u16603ej5v1ud 33 1.6 function block configuration 1.6.1 internal block diagram nmi toq00 to toq03 tiq00 to tiq03 rtp00 to rtp05, rtp10 to rtp15 sob0/scl01 note 3 sib0/sda01 note 3 sckb0 intp0 to intp8 intc 16-bit timer/ counter q: 1 ch top00 to top80, top01 to top81 tip00 to tip80, tip01 to tip81 16-bit timer/ counter p: 9 ch kr0 to kr7 rto iebus note 6 csib1 to csib3, csib5 dmac watchdog timer 2 watch timer key return function note 1 note 2 ram rom pc general-purpose registers 32 bits 32 multiplier 16 16 32 alu system registers 32-bit barrel shifter cpu hldrq hldak astb rd wait wr0, wr1 a0 to a23 ad0 to ad15 ic note 4 /flmd0 note 5 flmd1 note 5 ports cg regulator pll lvi note 9 internal oscillator clm cs0 to cs3 pcs0 to pcs7 pcm0 to pcm5 pct0 to pct7 pdh0 to pdh7 pdl0 to pdl15 pcd0 to pcd3 p90 to p915 p80, p81 p70 to p715 p60 to p615 p50 to p55 p40 to p42 p30 to p39 p10, p11 p00 to p06 av ref1 ano0, ano1 ani0 to ani15 av ss av ref0 adtrg clkout xt1 xt2 x1 x2 reset v dd v ss regc bv dd bv ss ev dd ev ss instruction queue bcu sob1 to sob3, sob5 sib1 to sib3, sib5 sckb1 to sckb3, sckb5 txda0/sob4 rxda0/sib4 ascka0/sckb4 txda2/sda00 note 3 rxda2/scl00 note 3 ietx0 note 6 ierx0 note 6 csib0 i 2 c01 note 3 rom correction 16-bit interval timer m: 1 ch uarta0 csib4 uarta2 i 2 c00 note 3 txda3 rxda3 uarta3 txda1/sda02 note 3 rxda1/scl02 note 3 uarta1 i 2 c02 note 3 on-chip debug funtion note 5 drst note 5 dms note 5 ddi note 5 dck note 5 ddo note 5 a/d converter d/a converter can0 note 7 , can1 note 8 ctxd0 note 7 , ctxd1 note 8 crxd0 note 7 , crxd1 note 8 notes 1. 384/512/640 kb (mask rom) (see table 1-1 ) 384/640 kb (flash memory) (see table 1-1 ) 2. 32/40/48 kb (see table 1-1 ) 3. i 2 c bus versions (y products) only 4. mask rom versions only 5. flash memory versions only 6. iebus controller versions only 7. can controller versions only 8. can controller (2-channel) versions only 9. v850es/sj2 only
chapter 1 introduction user?s manual u16603ej5v1ud 34 1.6.2 internal units (1) cpu the cpu uses five-stage pipeline control to enable single -clock execution of addres s calculations, arithmetic logic operations, data transfers, and almost all other instruction processing. other dedicated on-chip hardware, such as a multiplier (16 bits 16 bits 32 bits) and a barrel shifter (32 bits) contribute to faster complex processing. (2) bus control unit (bcu) the bcu starts a required external bus cycle based on the physical address obtai ned by the cpu. when an instruction is fetched from external memory space a nd the cpu does not send a bus cycle start request, the bcu generates a prefetch address and prefetches the instruction code. the pref etched instruction code is stored in an instruction queue. (3) rom this is a 640/512/384 kb mask rom or flash memory mapped to addresses 0000000h to 009ffffh/0000000h to 007ffffh/0000000h to 005ffffh. it can be accessed from the cpu in one clock during instruction fetch. (4) ram this is a 48/40/32 kb ram mapped to addresses 3ff3000h to 3ffefffh/3ff5000h to 3ffefffh/3ff7000h to 3ffefffh. it can be accessed from the cpu in one clock during data access. (5) interrupt controller (intc) this controller handles hardware interrupt requests (nmi, intp0 to intp8) from on-chip peripheral hardware and external hardware. eight levels of interrupt priorities can be specified for these interrupt requests, and multiplexed servicing control can be performed. (6) clock generator (cg) a main clock oscillator and subclock oscillator are pr ovided and generate the main clock oscillation frequency (f x ) and subclock frequency (f xt ), respectively. there are two modes in the clock-through mode, f x is used as the main clock frequency (f xx ) as is. in the pll mode, f x is used multiplied by 4 or 8. the cpu clock frequency (f cpu ) can be selected from among f xx , f xx /2, f xx /4, f xx /8, f xx /16, f xx /32, and f xt . (7) internal oscillator an internal oscillator is provided on chip. the oscillat ion frequency is 200 khz (typ). the internal oscillator supplies the clock for watchdog timer 2 and timer m. (8) timer/counter nine-channel 16-bit timer/event counter p (tmp), one- channel 16-bit timer/event counter q (tmq), and one- channel 16-bit interval timer m (tmm), are provided on chip. (9) watch timer this timer counts the reference time period (0.5 s) for counting the clock (the 32.768 khz subclock or the 32.768 khz clock f brg from prescaler 3). the watch timer can also be used as an interval timer for the main clock.
chapter 1 introduction user?s manual u16603ej5v1ud 35 (10) watchdog timer 2 a watchdog timer is provided on chip to detect inadv ertent program loops, system abnormalities, etc. either the internal oscillation clock, the main clock, or the subclock can be selected as the source clock. watchdog timer 2 generates a non-maskable interrupt request signal (intwdt2) or a system reset signal (wdt2res) after an overflow occurs. (11) serial interface the v850es/sj2 and v850es/sj2-h includ e three kinds of serial interfaces asynchronous serial interface a (uarta), 3-wire variable-length serial interface b (csib), and an i 2 c bus interface (i 2 c). in the case of uarta, data is transferred via the txda0 to txda3 pins and rxda0 to rxda3 pins. in the case of csib, data is transferred via the sob0 to sob5 pins, sib0 to sib5 pins, and sckb0 to sckb5 pins. in the case of i 2 c, data is transferred via the sda00 to sda02 and scl00 to scl02 pins. the i 2 c is provided only in i 2 c bus versions (y products) (see table 1-1 ). (12) iebus controller the iebus controller is a small-scale digital data transmission system for transferring data between units. the iebus controller is provided only in iebus controller versions. (13) can controller the can controller is a small-scale digital data transmission system for transferring data between units. the can controller is provided only in can controller versions. (14) a/d converter this 10-bit a/d converter includes 16 analog input pins. conversion is performed using the successive approximation method. (15) d/a converter a two-channel, 8-bit-resolution d/a converter that uses the r-2r ladder method is provided on chip. (16) dma controller a 4-channel dma controller is provided on chip. this controller transfers data between the internal ram and on-chip peripheral i/o devices in resp onse to interrupt requests sent by on-chip peripheral i/o. (17) rom correction a rom correction function that replaces part of a program in the mask rom with a program in the internal ram is provided. up to four correction addresses can be specified. (18) key interrupt function a key interrupt request signal (intkr) can be generated by inputting a falling edge to the key input pins (8 channels). (19) real-time output function the real-time output function transfe rs preset 6-bit data to output la tches upon the occurrence of a timer compare register match signal.
chapter 1 introduction user?s manual u16603ej5v1ud 36 (20) crc function a crc operation circuit that generates 16-bit crc (cycl ic redundancy check) code upon setting of 8-bit data is provided on chip. (21) on-chip debug function an on-chip debug function via an on-chip debug emulator that uses the jtag (joint test action group) communication specifications is provided. swit ching between the normal port function and on-chip debugging function is done with the control pi n input level and the ocdm register. the on-chip debug function is provided only in flash memory versions. (22) ports the following general-purpose port functions and control pin functions are available. port i/o alternate function p0 7-bit i/o timer i/o, nmi, external interrupt, a/d converter trigger, debug reset p1 2-bit i/o d/a converter analog output p3 10-bit i/o external interrupt, serial interface, timer i/o, can data i/o, iebus data i/o p4 3-bit i/o serial interface p5 6-bit i/o timer i/o, real-time output, key interrupt input, serial interface, debug i/o p6 16-bit i/o real-time output, serial interface, timer i/o p7 16-bit i/o a/d converter analog input p8 2-bit i/o serial interface, external interrupt p9 16-bit i/o external address bus, serial interface, key interrupt input, timer i/o, external interrupt pcd 4-bit i/o ? pcm 6-bit i/o external control signal pcs 8-bit i/o chip select output pct 8-bit i/o external control signal pdh 8-bit i/o external address bus pdl 16-bit i/o external address/data bus
user?s manual u16603ej5v1ud 37 chapter 2 pin functions 2.1 list of pin functions the names and functions of the pins in the v 850es/sj2 and v850es/sj2-h are described below. there are four types of pin i/o buffer power supplies: av ref0 , av ref1 , bv dd , and ev dd . the relationship between these power supplies and the pins is described below. table 2-1. pin i/o buffer power supplies power supply corresponding pins av ref0 port 7 av ref1 port 1 bv dd ports cd, cm, cs, ct, dh, dl ev dd reset, ports 0, 3 to 6, 8, 9
chapter 2 pin functions user?s manual u16603ej5v1ud 38 (1) port pins (1/4) pin name pin no. i/o function alternate function p00 6 tip61/top61 p01 7 tip60/top60 p02 17 nmi p03 18 intp0/adtrg p04 19 intp1 p05 note 1 20 intp2/drst note 2 p06 21 i/o port 0 7-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. intp3 p10 3 ano0 p11 4 i/o port 1 2-bit i/o port input/output can be specified in 1-bit units. ano1 p30 25 txda0/sob4 p31 26 rxda0/intp7/sib4 p32 27 ascka0/sckb4/tip00/top00 p33 28 tip01/top01/ctxd1 note 3 p34 29 tip10/top10/crxd1 note 3 p35 30 tip11/top11 p36 31 ctxd0 note 4 /ietx0 note 5 p37 32 crxd0 note 4 /ierx0 note 5 p38 35 txda2/sda00 note 6 p39 36 i/o port 3 10-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. rxda2/scl00 note 6 p40 22 sib0/sda01 note 6 p41 23 sob0/scl01 note 6 p42 24 i/o port 4 3-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. sckb0 p50 37 tiq01/kr0/toq01/rtp00 p51 38 tiq02/kr1/toq02/rtp01 p52 39 tiq03/kr2/toq03/rtp02/ddi note 2 p53 40 sib2/kr3/tiq00/toq00/rtp03/ ddo note 2 p54 41 sob2/kr4/rtp04/dck note 2 p55 42 i/o port 5 6-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. sckb2/kr5/rtp05/dms note 2 notes 1. fix this pin to low level from when the reset status has been released unt il the ocdm.ocdm0 bit is cleared (0) when the on-chip debug function is not used. for details, see 4.6.3 cautions on on-chip debug pins . a pull-down resistor is incorporated. it can be disconnected by clearing the ocdm.ocdm0 bit to 0. 2. flash memory versions only 3. can controller (2-channel) versions only 4. can controller versions only 5. iebus controller versions only 6. i 2 c bus versions (y products) only
chapter 2 pin functions user?s manual u16603ej5v1ud 39 (2/4) pin name pin no. i/o function alternate function p60 43 rtp10 p61 44 rtp11 p62 45 rtp12 p63 46 rtp13 p64 47 rtp14 p65 48 rtp15 p66 49 sib5 p67 50 sob5 p68 51 sckb5 p69 52 tip70/top70 p610 53 tip71 p611 54 top71 p612 55 tip80/top80 p613 56 tip81/top81 p614 57 ? p615 58 i/o port 6 16-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. ? p70 144 ani0 p71 143 ani1 p72 142 ani2 p73 141 ani3 p74 140 ani4 p75 139 ani5 p76 138 ani6 p77 137 ani7 p78 136 ani8 p79 135 ani9 p710 134 ani10 p711 133 ani11 p712 132 ani12 p713 131 ani13 p714 130 ani14 p715 129 i/o port 7 16-bit i/o port input/output can be specified in 1-bit units. ani15 p80 59 rxda3/intp8 p81 60 i/o port 8 2-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. txda3
chapter 2 pin functions user?s manual u16603ej5v1ud 40 (3/4) pin name pin no. i/o function alternate function p90 61 a0/kr6/txda1/sda02 note p91 62 a1/kr7/rxda1/scl02 note p92 63 a2/tip41/top41 p93 64 a3/tip40/top40 p94 65 a4/tip31/top31 p95 66 a5/tip30/top30 p96 67 a6/tip21/top21 p97 68 a7/sib1/tip20/top20 p98 69 a8/sob1 p99 70 a9/sckb1 p910 71 a10/sib3 p911 72 a11/sob3 p912 73 a12/sckb3 p913 74 a13/intp4 p914 75 a14/intp5/tip51/top51 p915 76 i/o port 9 16-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. a15/intp6/tip50/top50 pcd0 77 ? pcd1 78 ? pcd2 79 ? pcd3 80 i/o port cd 4-bit i/o port input/output can be specified in 1-bit units. ? pcm0 85 wait pcm1 86 clkout pcm2 87 hldak pcm3 88 hldrq pcm4 89 ? pcm5 90 i/o port cm 6-bit i/o port input/output can be specified in 1-bit units. ? pcs0 81 cs0 pcs1 82 cs1 pcs2 83 cs2 pcs3 84 cs3 pcs4 91 ? pcs5 92 ? pcs6 93 ? pcs7 94 i/o port cs 8-bit i/o port input/output can be specified in 1-bit units. ? note i 2 c bus versions (y products) only
chapter 2 pin functions user?s manual u16603ej5v1ud 41 (4/4) pin name pin no. i/o function alternate function pct0 95 wr0 pct1 96 wr1 pct2 97 ? pct3 98 ? pct4 99 rd pct5 100 ? pct6 101 astb pct7 102 i/o port ct 8-bit i/o port input/output can be specified in 1-bit units. ? pdh0 121 a16 pdh1 122 a17 pdh2 123 a18 pdh3 124 a19 pdh4 125 a20 pdh5 126 a21 pdh6 127 a22 pdh7 128 i/o port dh 8-bit i/o port input/output can be specified in 1-bit units. a23 pdl0 105 ad0 pdl1 106 ad1 pdl2 107 ad2 pdl3 108 ad3 pdl4 109 ad4 pdl5 110 ad5/flmd1 note pdl6 111 ad6 pdl7 112 ad7 pdl8 113 ad8 pdl9 114 ad9 pdl10 115 ad10 pdl11 116 ad11 pdl12 117 ad12 pdl13 118 ad13 pdl14 119 ad14 pdl15 120 i/o port dl 16-bit i/o port input/output can be specified in 1-bit units. ad15 note flash memory versions only
chapter 2 pin functions user?s manual u16603ej5v1ud 42 (2) non-port pins (1/7) pin name pin no. i/o function alternate function a0 61 p90/kr6/txda1/sda02 note 1 a1 62 p91/kr7/rxda1/scl02 note 1 a2 63 p92/tip41/top41 a3 64 p93/tip40/top40 a4 65 p94/tip31/top31 a5 66 p95/tip30/top30 a6 67 p96/tip21/top21 a7 68 p97/sib1/tip20/top20 a8 69 p98/sob1 a9 70 p99/sckb1 a10 71 p910/sib3 a11 72 p911/sob3 a12 73 p912/sckb3 a13 74 p913/intp4 a14 75 p914/intp5/tip51/top51 a15 76 output address bus for external memory (when using separate bus) port 9 cannot be used as port pins or other alternate- function pins when the a0 to a15 pins are used in the separate bus mode. n-ch open-drain output selectable. 5 v tolerant. p915/intp6/tip50/top50 a16 121 pdh0 a17 122 pdh1 a18 123 pdh2 a19 124 pdh3 a20 125 pdh4 a21 126 pdh5 a22 127 pdh6 a23 128 output address bus for external memory pdh7 ad0 105 pdl0 ad1 106 pdl1 ad2 107 pdl2 ad3 108 pdl3 ad4 109 pdl4 ad5 110 pdl5/flmd1 note 2 ad6 111 pdl6 ad7 112 pdl7 ad8 113 pdl8 ad9 114 pdl9 ad10 115 pdl10 ad11 116 pdl11 ad12 117 pdl12 ad13 118 pdl13 ad14 119 pdl14 ad15 120 i/o address bus/data bus for external memory pdl15 notes 1. i 2 c bus versions (y products) only 2. flash memory versions only
chapter 2 pin functions user?s manual u16603ej5v1ud 43 (2/7) pin name pin no. i/o function alternate function adtrg 18 input a/d converter external trigger input. 5 v tolerant. p03/intp0 ani0 144 p70 ani1 143 p71 ani2 142 p72 ani3 141 p73 ani4 140 p74 ani5 139 p75 ani6 138 p76 ani7 137 p77 ani8 136 p78 ani9 135 p79 ani10 134 p710 ani11 133 p711 ani12 132 p712 ani13 131 p713 ani14 130 p714 ani15 129 input analog voltage input for a/d converter p715 ano0 3 p10 ano1 4 output analog voltage output for d/a converter p11 ascka0 27 input uarta0 baud rate clock input. 5 v tolerant. p32/sckb4/tip00/top00 astb 101 output address strobe signal output for external memory pct6 av ref0 1 reference voltage input for a/d converter/positive power supply for port 7 ? av ref1 5 ? reference voltage input for d/a converter/positive power supply for port 1 ? av ss 2 ? ground potential for a/d and d/a converters (same potential as v ss ) ? bv dd 104 ? positive power supply pin for bus interface and alternate- function ports ? bv ss 103 ? ground potential for bus interface and alternate-function ports ? clkout 86 output internal system clock output pcm1 crxd0 note 1 32 p37/ierx0 note 2 crxd1 note 3 29 input can receive data input. 5 v tolerant. p34/tip10/top10 cs0 81 pcs0 cs1 82 pcs1 cs2 83 pcs2 cs3 84 output chip select output pcs3 ctxd0 note 1 31 p36/ietx0 note 2 ctxd1 note 3 28 output can0 and can1 transmit data output. n-ch open-drain output selectable. 5 v tolerant. p33/tip01/top01 notes 1. can controller versions only 2. iebus controller versions only 3. can controller (2-channel) versions only
chapter 2 pin functions user?s manual u16603ej5v1ud 44 (3/7) pin name pin no. i/o function alternate function dck note 1 41 input debug clock input. 5 v tolerant. p54/sob2/kr4/rtp04 ddi note 1 39 input debug data input. 5 v tolerant. p52/tiq03/kr2/toq03/rtp02 ddo notes 1, 2 40 output debug data output. n-ch open-drain output selectable. 5 v tolerant. p53/sib2/kr3/tiq00/toq00/ rtp03 dms note 1 42 input debug mode select input. 5 v tolerant. p55/sckb2/kr5/rtp05 drst note 1 20 input debug reset input. 5 v tolerant. p05/intp2 ev dd 34 ? positive power supply for external (same potential as v dd ) ? ev ss 33 ? ground potential for external (same potential as v ss ) ? flmd0 note 1 8 ? flmd1 note 1 110 input flash memory programming mode setting pin pdl5/ad5 hldak 87 output bus hold acknowledge output pcm2 hldrq 88 input bus hold request input pcm3 ic note 3 8 ? internally connected ? ierx0 note 4 32 input iebus receive data input. 5 v tolerant. p37/crxd0 note 5 ietx0 note 4 31 output iebus transmit data output. n-ch open-drain output selectable. 5 v tolerant. p36/ctxd0 note 5 intp0 18 p03/adtrg intp1 19 p04 intp2 20 p05/drst note 1 intp3 21 p06 intp4 74 p913/a13 intp5 75 p914/a14/tip51/top51 intp6 76 p915/a15/tip50/top50 intp7 26 p31/rxda0/sib4 intp8 59 input external interrupt request input (maskable, analog noise elimination). analog noise elimination or digital noise elimination selectable for intp3 pin. 5 v tolerant. p80/rxda3 kr0 note 6 37 p50/tiq01/toq01/rtp00 kr1 note 6 38 p51/tiq02/toq02/rtp01 kr2 note 6 39 p52/tiq03/toq03/ rtp02/ddi note 1 kr3 note 6 40 p53/sib2/tiq00/toq00/ rtp03/ddo note 1 kr4 note 6 41 p54/sob2/rtp04/dck note 1 kr5 note 6 42 p55/sckb2/rtp05/dms note 1 kr6 note 6 61 p90/a0/txda1/sda02 note 7 kr7 note 6 62 input key interrupt input (on-chip analog noise eliminator). 5 v tolerant. p91/a1/rxda1/scl02 note 7 notes 1. flash memory versions only 2. in the on-chip debug mode, high-level output is forcibly set. 3. mask rom versions only 4. iebus controller versions only 5. can controller versions only 6. pull this pin up externally. 7. i 2 c bus versions (y products) only
chapter 2 pin functions user?s manual u16603ej5v1ud 45 (4/7) pin name pin no. i/o function alternate function nmi note 1 17 input external interrupt input (non-maskable, analog noise elimination). 5 v tolerant. p02 rd 99 output read strobe signal output for external memory pct4 regc 10 ? connection of regulator output stabilization capacitance (4.7 f) ? reset 14 input system reset input ? rtp00 37 p50/tiq01/kr0/toq01 rtp01 38 p51/tiq02/kr1/toq02 rtp02 39 p52/tiq03/kr2/toq03/ddi note 2 rtp03 40 p53/sib2/kr3/tiq00/toq00/ ddo note 2 rtp04 41 p54/sob2/kr4/dck note 2 rtp05 42 p55/sckb2/kr5/dms note 2 rtp10 43 p60 rtp11 44 p61 rtp12 45 p62 rtp13 46 p63 rtp14 47 p64 rtp15 48 output real-time output port. n-ch open-drain output selectable. 5 v tolerant. p65 rxda0 26 p31/intp7/sib4 rxda1 62 p91/a1/kr7/scl02 note 3 rxda2 36 p39/scl00 note 3 rxda3 59 input serial receive data input (uarta0 to uarta3) 5 v tolerant. p80/intp8 sckb0 24 p42 sckb1 70 p99/a9 sckb2 42 p55/kr5/rtp05/dms note 2 sckb3 73 p912/a12 sckb4 27 p32/ascka0/tip00/top00 sckb5 51 i/o serial clock i/o (csib0 to csib5) n-ch open-drain output selectable. 5 v tolerant. p68 scl00 note 3 36 p39/rxda2 scl01 note 3 23 p41/sob0 scl02 note 3 62 i/o serial clock i/o (i 2 c00 to i 2 c02) n-ch open-drain output selectable. 5 v tolerant. p91/a1/kr7/rxda1 sda00 note 3 35 p38/txda2 sda01 note 3 22 p40/sib0 sda02 note 3 61 i/o serial transmit/receive data i/o (i 2 c00 to i 2 c02) n-ch open-drain output selectable. 5 v tolerant. p90/a0/kr6/txda1 notes 1. the nmi pin alternately functions as the p02 pin. it f unctions as the p02 pin after reset. to enable the nmi pin, set the pmc0.pmc02 bit to 1. the initial setting of the nmi pin is ?no edge detected?. select the nmi pin valid edge using intf0 and intr0 registers. 2. flash memory versions only 3. i 2 c bus versions (y products) only
chapter 2 pin functions user?s manual u16603ej5v1ud 46 (5/7) pin name pin no. i/o function alternate function sib0 22 p40/sda01 note 1 sib1 68 p97/a7/tip20/top20 sib2 40 p53/kr3/tiq00/toq00/rtp03/ ddo note 2 sib3 71 p910/a10 sib4 26 p31/rxda0/intp7 sib5 49 input serial receive data input (csib0 to csib5) 5 v tolerant. p66 sob0 23 p41/scl01 note 1 sob1 69 p98/a8 sob2 41 p54/kr4/rtp04/dck note 2 sob3 72 p911/a11 sob4 25 p30/txda0 sob5 50 output serial transmit data output (csib0 to csib5) n-ch open-drain output selectable. 5 v tolerant. p67 tip00 27 external event count input/capture trigger input/external trigger input (tmp0). 5 v tolerant. p32/ascka0/sckb4/top00 tip01 28 capture trigger input (tmp0). 5 v tolerant. p33/top01/ctxd1 note 3 tip10 29 external event count input/capture trigger input/external trigger input (tmp1). 5 v tolerant. p34/top10/crxd1 note 3 tip11 30 capture trigger input (tmp1). 5 v tolerant. p35/top11 tip20 68 external event count input/capture trigger input/external trigger input (tmp2). 5 v tolerant. p97/a7/sib1/top20 tip21 67 capture trigger input (tmp2). 5 v tolerant. p96/a6/top21 tip30 66 external event count input/capture trigger input/external trigger input (tmp3). 5 v tolerant. p95/a5/top30 tip31 65 capture trigger input (tmp3). 5 v tolerant. p94/a4/top31 tip40 64 external event count input/capture trigger input/external trigger input (tmp4). 5 v tolerant. p93/a3/top40 tip41 63 input capture trigger input (tmp4). 5 v tolerant. p92/a2/top41 notes 1. i 2 c bus versions (y products) only 2. flash memory versions only 3. can controller (2-channel) versions only
chapter 2 pin functions user?s manual u16603ej5v1ud 47 (6/7) pin name pin no. i/o function alternate function tip50 76 external event count input/capture trigger input/external trigger input (tmp5). 5 v tolerant. p915/a15/intp6/top50 tip51 75 capture trigger input (tmp5). 5 v tolerant. p914/a14/intp5/top51 tip60 7 external event count input/capture trigger input/external trigger input (tmp6). 5 v tolerant. p01/top60 tip61 6 capture trigger input (tmp6). 5 v tolerant. p00/top61 tip70 52 external event count input/capture trigger input/external trigger input (tmp7). 5 v tolerant. p69/top70 tip71 53 capture trigger input (tmp7). 5 v tolerant. p610 tip80 55 external event count input/capture trigger input/external trigger input (tmp8). 5 v tolerant. p612/top80 tip81 56 input capture trigger input (tmp8). 5 v tolerant. p613/top81 tiq00 40 external event count input/capture trigger input/external trigger input (tmq0). 5 v tolerant. p53/sib2/kr3/toq00/rtp03/ ddo note 1 tiq01 37 p50/kr0/toq01/rtp00 tiq02 38 p51/kr1/toq02/rtp01 tiq03 39 input capture trigger input (tmq0). 5 v tolerant. p52/kr2/toq03/rtp02/ddi note 1 top00 27 p32/ascka0/sckb4/tip00 top01 28 timer output (tmp0) n-ch open-drain output selectable. 5 v tolerant. p33/tip01/ctxd1 note 2 top10 29 p34/tip10/crxd1 note 2 top11 30 timer output (tmp1) n-ch open-drain output selectable. 5 v tolerant. p35/tip11 top20 68 p97/a7/sib1/tip20 top21 67 timer output (tmp2) n-ch open-drain output selectable. 5 v tolerant. p96/a6/tip21 top30 66 p95/a5/tip30 top31 65 timer output (tmp3) n-ch open-drain output selectable. 5 v tolerant. p94/a4/tip31 top40 64 p93/a3/tip40 top41 63 timer output (tmp4) n-ch open-drain output selectable. 5 v tolerant. p92/a2/tip41 top50 76 p915/a15/intp6/tip50 top51 75 timer output (tmp5) n-ch open-drain output selectable. 5 v tolerant. p914/a14/intp5/tip51 top60 7 p01/tip60 top61 6 output timer output (tmp6) n-ch open-drain output selectable. 5 v tolerant. p00/tip61 notes 1. flash memory versions only 2. can controller (2-channel) versions only
chapter 2 pin functions user?s manual u16603ej5v1ud 48 (7/7) pin name pin no. i/o function alternate function top70 52 p69/tip70 top71 54 timer output (tmp7) n-ch open-drain output selectable. 5 v tolerant. p611 top80 55 p612/tip80 top81 56 output timer output (tmp8) n-ch open-drain output selectable. 5 v tolerant. p613/tip81 toq00 40 p53/sib2/kr3/tiq00/rtp03/ ddo note 1 toq01 37 p50/tiq01/kr0/rtp00 toq02 38 p51/rtp01/kr1/tiq02 toq03 39 output timer output (tmq0) n-ch open-drain output selectable. 5 v tolerant. p52/tiq03/kr2/rtp02/ddi note 1 txda0 25 p30/sob4 txda1 61 p90/a0/kr6/sda02 note 2 txda2 35 p38/sda00 note 2 txda3 60 output serial transmit data output (uarta0 to uarta3) n-ch open-drain output selectable. 5 v tolerant. p81 v dd 9 ? positive power supply pin for internal ? v ss 11 ? ground potential for internal ? wait 85 input external wait input pcm0 wr0 95 write strobe for external memory (lower 8 bits) pct0 wr1 96 output write strove for external memory (higher 8 bits) pct1 x1 12 input ? x2 13 ? connection of resonator for main clock ? xt1 15 input ? xt2 16 ? connection of resonator for subclock ? notes 1. flash memory versions only 2. i 2 c bus versions (y products) only
chapter 2 pin functions user?s manual u16603ej5v1ud 49 2.2 pin states the operation states of pins in the various modes are described below. table 2-2. pin operation states in various modes pin name during reset (immediately after power is turned on) during reset (except immediately after power is turned on) halt mode note 2 idle1, idle2, sub-idle mode note 2 stop mode note 2 idle state note 3 bus hold p05/drst note 4 pulled down pulled down note 5 held held held held held p10/ano0, p11/ano1 hi-z held held note 11 held held p53/ddo note 4 undefined note 1 hi-z note 6 held held held held held ad0 to ad15 notes 8, 9 a0 to a15 undefined notes 8, 10 a16 to a23 undefined note 8 hi-z hi-z held hi-z wait ? ? ? ? ? clkout operating l l operating operating wr0, wr1 rd astb h note 8 hi-z hldak h h h l hldrq operating note 8 ? ? ? operating cs0 to cs3 hi-z note 7 hi-z note 7 h note 8 h h held hi-z other port pins hi-z hi-z held held held held held notes 1. these pins may momentarily output an un defined level upon power application. 2. operates while an alternate function is operating. 3. in separate bus mode, the state of the pins in the id le state inserted after the t2 state is shown. in multiplexed bus mode, the state of the pins in the idle state inserted after the t3 state is shown. 4. flash memory versions only 5. pulled down during external reset. during internal reset by the watchdog timer, clock monitor, etc., the state of this pin differs according to the ocdm.ocdm0 bit setting. 6. ddo output is specified in the on-chip debug mode. 7. the bus control pins function alternately as port pins, so they are initialized to the input mode (port mode). 8. operates even in the halt mode, during dma operation. 9. in separate bus mode: hi-z in multiplexed bus mode: undefined 10. in separate bus mode 11. in port mode: held when alternate function is used: hi-z remark hi-z: high impedance held: the state during the immediately preceding external bus cycle is held. l: low-level output h: high-level output ? : input without sampling (not acknowledged)
chapter 2 pin functions user?s manual u16603ej5v1ud 50 2.3 pin i/o circuit types, i/o buffer power supplies, and connection of unused pins (1/3) pin alternate function pin no. i/o circuit type recommended connection p00 tip61/top61 6 p01 tip60/top60 7 p02 nmi 17 p03 intp0/adtrg 18 p04 intp1 19 10-d input: independently connect to ev dd or ev ss via a resistor. output: leave open. p05 intp2/drst note 1 20 10-n input: independently connect to ev ss via a resistor. fixing to v dd level is prohibited. output: leave open. internally pull-down after reset by reset pin. p06 intp3 21 10-d input: independently connect to ev dd or ev ss via a resistor. output: leave open. p10, p11 ano0, ano1 3, 4 12-d input: independently connect to av ref1 or av ss via a resistor. output: leave open. p30 txda0/sob4 25 10-g p31 rxda0/intp7/sib4 26 p32 ascka0/sckb4/tip00 27 p33 tip01/top01/ctxd1 note 2 28 p34 tip10/top10/crxd1 note 2 29 p35 tip11/top11 30 10-d p36 ctxd0 note 3 /ietx0 note 4 31 10-g p37 crxd0 note 3 /ierx0 note 4 32 p38 txda2/sda00 note 5 35 p39 rxda2/scl00 note 5 36 p40 sib0/sda01 note 5 22 p41 sob0/scl01 note 5 23 p42 sckb0 24 p50 tiq01/kr0/toq01/rtp00 37 p51 tiq02/kr1/toq02/rtp01 38 p52 tiq03/kr2/toq03/rtp02/ ddi note 1 39 p53 sib2/kr3/tiq00/toq00/ rtp03/ddo note 1 40 p54 sob2/kr4/rtp04/dck note 1 41 p55 sckb2/kr5/rtp05/dms note 1 42 10-d input: independently connect to ev dd or ev ss via a resistor. output: leave open. notes 1. flash memory versions only 2. can controller (2-channel) versions only 3. can controller versions only 4. iebus controller versions only 5. i 2 c bus versions (y products) only
chapter 2 pin functions user?s manual u16603ej5v1ud 51 (2/3) pin alternate function pin no. i/o circuit type recommended connection p60 to p65 rtp10 to rtp15 43 to 48 10-g p66 sib5 49 10-d p67 sob5 50 10-g p68 sckb5 51 p69 tip70/top70 52 p610 tip71 53 10-d p611 top71 54 10-g p612 tip80/top80 55 p613 tip81/top81 56 10-d p614, p615 ? 57, 58 10-g input: independently connect to ev dd or ev ss via a resistor. output: leave open. p70 to p715 ani0 to ani15 144 to 129 11-g input: independently connect to av ref0 or av ss via a resistor. output: leave open. p80 rxda3, intp8 59 10-d p81 txda3 60 10-g p90 a0/kr6/tdxa1/sda02 note 61 p91 a1/kr7/rxda1/scl02 note 62 p92 a2/tip41/top41 63 p93 a3/tip40/top40 64 p94 a4/tip31/top31 65 p95 a5/tip30/top30 66 p96 a6/tip21/top21 67 p97 a7/sib1/tip20/top20 68 10-d p98 a8/sob1 69 10-g p99 a9/sckb1 70 p910 a10/sib3 71 10-d p911 a11/sob3 72 10-g p912 a12/sckb3 73 p913 a13/intp4 74 p914 a14/intp5/tip51/top51 75 p915 a15/intp6/tip50/top50 76 10-d input: independently connect to ev dd or ev ss via a resistor. output: leave open. pcd0 to pcd3 ? 77 to 80 pcm0 wait 85 pcm1 clkout 86 pcm2 hldak 87 pcm3 hldrq 88 pcm4, pcm5 ? 89, 90 pcs0 to pcs3 cs0 to cs3 81 to 84 pcs4 to pcs7 ? 91 to 94 5 input: independently connect to bv dd or bv ss via a resistor. output: leave open. note i 2 c bus versions (y products) only
chapter 2 pin functions user?s manual u16603ej5v1ud 52 (3/3) pin alternate function pin no. i/o circuit type recommended connection pct0, pct1 wr0, wr1 95, 96 pct2, pct3 ? 97, 98 pct4 rd 99 pct5 ? 100 pct6 astb 101 pct7 ? 102 pdh0 to pdh7 a16 to a23 121 to 128 pdl0 to pdl4 ad0 to ad4 105 to 109 pdl5 ad5/flmd1 note 1 110 pdl6 to pdl15 ad6 to ad15 111 to 120 5 input: independently connect to bv dd or bv ss via a resistor. output: leave open. av ref0 ? 1 ? av ref1 ? 5 ? always connect this pin to the power supply (also in the standby mode). av ss ? 2 ? always connect this pin directly to the ground (also in the standby mode). bv dd ? 104 ? always connect this pin to the power supply (also in the standby mode). bv ss ? 103 ? always connect this pin directly to the ground (also in the standby mode). ev dd ? 34 ? always connect this pin to the power supply (also in the standby mode). ev ss ? 33 ? always connect this pin directly to the ground (also in the standby mode). flmd0 note 1 ? 8 ? directly connect to v ss in a mode other than the flash memory programming mode. ic note 2 ? 8 ? directly connect to v ss . regc ? 10 ? connect regulator output stabilization capacitance (4.7 f). reset ? 14 2 ? v dd ? 9 ? always connect this pin to the power supply (also in the standby mode). v ss ? 11 ? always connect this pin directly to the ground (also in the standby mode). x1 ? 12 ? ? x2 ? 13 ? ? xt1 ? 15 16 connect to v ss . xt2 ? 16 16 leave open. notes 1. flash memory versions only 2. mask rom versions only
chapter 2 pin functions user?s manual u16603ej5v1ud 53 figure 2-1. pin i/o circuits type 2 schmitt-triggered input with hysteresis characteristics type 5 in data output disable p-ch in/out in/out ev dd /bv dd ev ss /bv ss n-ch input enable type 11-g type 12-d type 10-d data output disable ev dd ev ss note p-ch in/out n-ch open drain input enable data output disable av ref0 p-ch in/out n-ch p-ch n-ch av ref0 (threshold voltage) comparator input enable + _ av ss av ss data output disable input enable av ref1 p-ch in/out n-ch p-ch n-ch analog output voltage av ss type 10-n data output disable ev dd ev ss p-ch in/out n-ch open drain input enable ocdm0 bit note n-ch type 16 p-ch feedback cut-off xt1 xt2 type 10-g data output disable ev dd ev ss p-ch in/out n-ch open drain input enable note hysteresis characteristics are not available in port mode.
chapter 2 pin functions user?s manual u16603ej5v1ud 54 2.4 cautions (1) cautions on power application when the power is turned on, the following pins may momentarily output an undefined level. ? p10/ano0 pin ? p11/ano1 pin ? p53/sib2/kr3/tiq00/toq00/rtp03/ddo note pin note the ddo pin is provided only in the flash memory versions. (2) cautions on flmd0 pin to accurately start the user program operation, fix the flmd0 pin to low level from when the reset status has been released until the oscillation stabilization time elaps es and the firmware operation is completed. for details of firmware operation, see 25.3.5 (2) firmware operation (flash memory version only).
user?s manual u16603ej5v1ud 55 chapter 3 cpu function the cpu of the v850es/sj2 and v850e s/sj2-h is based on risc archit ecture and executes almost all instructions with one clock by using a 5-stage pipeline. 3.1 features minimum instruction execution time: v850es/sj2: 50 ns (operating with main clock (f xx ) = 20 mhz) v850es/sj2-h: 31.25 ns (operating with main clock (f xx ) = 32 mhz) 30.5 s (operating with subclock (f xt ) = 32.768 khz) memory space program (physical address) space: 64 mb linear data (logical address) space: 4 gb linear general-purpose registers: 32 bits 32 registers internal 32-bit architecture 5-stage pipeline control multiplication/division instruction saturation operation instruction 32-bit shift instruction: 1 clock load/store instruction with long/short format four types of bit manipulation instructions ? set1 ? clr1 ? not1 ? tst1
chapter 3 cpu function user?s manual u16603ej5v1ud 56 3.2 cpu register set the registers of the v850es/sj2 and v850es/sj2-h can be classified into two types: general-purpose program registers and dedicated system registers. all the registers are 32 bits wide. for details, refer to the v850es architecture user?s manual . r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 (zero register) (assembler-reserved register) (stack pointer (sp)) (global pointer (gp)) (text pointer (tp)) (element pointer (ep)) (link pointer (lp)) pc (program counter) psw (program status word) ecr (interrupt source register) fepc fepsw (nmi status saving register) (nmi status saving register) eipc eipsw (interrupt status saving register) (interrupt status saving register) 31 0 31 0 31 0 ctbp (callt base pointer) dbpc dbpsw (exception/debug trap status saving register) (exception/debug trap status saving register) ctpc ctpsw (callt execution status saving register) (callt execution status saving register)
chapter 3 cpu function user?s manual u16603ej5v1ud 57 3.2.1 program register set the program registers include general-p urpose registers and a program counter. (1) general-purpose registers (r0 to r31) thirty-two general-purpose registers, r0 to r31, are av ailable. any of these registers can be used to store a data variable or an address variable. however, r0 and r30 are implicitly used by instructions and care must be exercised when these registers are used. r0 always holds 0 and is used for an operation that uses 0 or addressing of offset 0. r30 is used by the sld and sst instructions as a base pointer when these inst ructions access the memory. r1, r3 to r5, and r31 are implicitly used by the assembler and c compiler. when using these registers, save their contents for protection, and then restore the contents after using the registers. r2 is sometimes used by the real-time os. if the real-time os does not use r2, it can be used as a register for variables. table 3-1. program registers name usage operation r0 zero register always holds 0. r1 assembler-reserved register used as work ing register to create 32-bit immediate data r2 register for address/data variable (if real-time os does not use r2) r3 stack pointer used to create a stack frame when a function is called r4 global pointer used to access a global variable in the data area r5 text pointer used as register that i ndicates the beginning of a text area (area where program codes are located) r6 to r29 register for address/data variable r30 element pointer used as base pointer to access memory r31 link pointer used when t he compiler calls a function pc program counter holds the instruction address during program execution remark for further details on the r1, r3 to r5, and r31 that are used in the assembler and c compiler, refer to the ca850 (c compiler package) assembly language user?s manual . (2) program counter (pc) the program counter holds the instructi on address during program execution. the lower 32 bits of this register are valid. bits 31 to 26 are fixed to 0. a carry from bit 25 to 26 is ignored even if it occurs. bit 0 is fixed to 0. this means that execution cannot branch to an odd address. 31 26 25 1 0 pc fixed to 0 instruction address during program execution 0 default value 00000000h
chapter 3 cpu function user?s manual u16603ej5v1ud 58 3.2.2 system register set the system registers control the status of the cpu and hold interrupt information. these registers can be read or written by using system register load/sto re instructions (ldsr and stsr), using the system register numbers listed below. table 3-2. system register numbers operand specification system register number system register name ldsr instruction stsr instruction 0 interrupt status saving register (eipc) note 1 1 interrupt status saving register (eipsw) note 1 2 nmi status saving register (fepc) note 1 3 nmi status saving register (fepsw) note 1 4 interrupt source register (ecr) 5 program status word (psw) 6 to 15 reserved for future function expansion (operation is not guaranteed if these registers are accessed) 16 callt execution status saving register (ctpc) 17 callt execution status saving register (ctpsw) 18 exception/debug trap status saving register (dbpc) note 2 note 2 19 exception/debug trap status saving register (dbpsw) note 2 note 2 20 callt base pointer (ctbp) 21 to 31 reserved for future function expansion (operation is not guaranteed if these registers are accessed) notes 1. because only one set of these registers is availa ble, the contents of these registers must be saved by program if multiple interrupts are enabled. 2. these registers can be accessed only during the interval between the execution of the dbtrap instruction or illegal opcode ex ecution and dbret instruction. caution even if eipc or fepc, or bit 0 of ctpc is set to 1 by the ldsr instruction, bit 0 is ignored when execution is returned to the main routine by the reti instruction after interrupt ser vicing (this is because bit 0 of the pc is fixed to 0). set an even value to eipc, fepc, and ctpc (bit 0 = 0). remark : can be accessed : access prohibited
chapter 3 cpu function user?s manual u16603ej5v1ud 59 (1) interrupt status saving registers (eipc and eipsw) eipc and eipsw are used to save the status when an interrupt occurs. if a software exception or a maskable interrupt occurs, th e contents of the program counter (pc) are saved to eipc, and the contents of the program status word ( psw) are saved to eipsw (these contents are saved to the nmi status saving registers (fepc and f epsw) if a non-maskable interrupt occurs). the address of the instruction next to the instruction under execution, except some instructions (see 22.8 periods in which interrupts are not acknowledged by cpu ), is saved to eipc when a software exception or a maskable interrupt occurs. the current contents of the psw are saved to eipsw. because only one set of interrupt status saving registers is available, the contents of these registers must be saved by program when multiple interrupts are enabled. bits 31 to 26 of eipc and bits 31 to 8 of eipsw are reserved for future function expansion (these bits are always fixed to 0). the value of eipc is restored to the pc and the val ue of eipsw to the psw by the reti instruction. 31 0 eipc (contents of saved pc) 0 0 default value 0xxxxxxxh (x: undefined) 26 25 0 0 0 0 31 0 eipsw (contents of saved psw) 0 0 default value 000000xxh (x: undefined) 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
chapter 3 cpu function user?s manual u16603ej5v1ud 60 (2) nmi status saving registers (fepc and fepsw) fepc and fepsw are used to save the status when a non-maskable interrupt (nmi) occurs. if an nmi occurs, the contents of the program counter (pc) are saved to fepc, and those of the program status word (psw) are saved to fepsw. the address of the instruction next to the one of the instruction under exec ution, except some instructions, is saved to fepc when an nmi occurs. the current contents of t he psw are saved to fepsw. because only one set of nmi status saving registers is avai lable, the contents of thes e registers must be saved by program when multiple interrupts are enabled. bits 31 to 26 of fepc and bits 31 to 8 of fepsw are re served for future function expansion (these bits are always fixed to 0). the value of fepc is restored to the pc and the value of fepsw to the psw by the reti instruction. 31 0 fepc (contents of saved pc) 0 0 default value 0xxxxxxxh (x: undefined) 26 25 0 0 0 0 31 0 fepsw (contents of saved psw) 0 0 default value 000000xxh (x: undefined) 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (3) interrupt source register (ecr) the interrupt source register (ecr) hol ds the source of an exception or in terrupt if an exception or interrupt occurs. this register holds the exception code of each interrupt source. because this register is a read-only register, data cannot be written to this register using the ldsr instruction. 31 0 ecr fecc eicc default value 00000000h 16 15 bit position bit name meaning 31 to 16 fecc exception code of non-maskable interrupt (nmi) 15 to 0 eicc exception code of exception or maskable interrupt
chapter 3 cpu function user?s manual u16603ej5v1ud 61 (4) program status word (psw) the program status word (psw) is a collection of flags that indicate th e status of the program (result of instruction execution) and the status of the cpu. if the contents of a bit of this regi ster are changed by using the ldsr instruction, the new contents are validated immediately after completion of ldsr instructi on execution. however if the id flag is set to 1, interrupt requests will not be acknowledged while the ldsr instruction is being executed. bits 31 to 8 of this register are reserved for future function expansion (these bits are fixed to 0). (1/2) 31 0 psw rfu default value 00000020h 87 np 6 ep 5 id 4 sat 3 cy 2 ov 1 sz bit position flag name meaning 31 to 8 rfu reserved field. fixed to 0. 7 np indicates that a non-maskable interrupt (nmi) is being serviced. this bit is set to 1 when an nmi request is acknowledged, disabling multiple interrupts. 0: nmi is not being serviced. 1: nmi is being serviced. 6 ep indicates that an exception is being proces sed. this bit is set to 1 when an exception occurs. even if this bit is set, interrupt requests are acknowledged. 0: exception is not being processed. 1: exception is being processed. 5 id indicates whether a maskable interrupt can be acknowledged. 0: interrupt enabled 1: interrupt disabled 4 sat note indicates that the result of a saturation operation has overflowed and is saturated. because this is a cumulative flag, it is set to 1 when the result of a saturation operation instruction is saturated, and is not cleared to 0 even if the subsequent operation result is not saturated. use the ldsr instruction to clear this bit. th is flag is neither set to 1 nor cleared to 0 by execution of an arithmetic operation instruction. 0: not saturated 1: saturated 3 cy indicates whether a ca rry or a borrow occurs as a result of an operation. 0: carry or borrow does not occur. 1: carry or borrow occurs. 2 ov note indicates whether an overflow occurs during operation. 0: overflow does not occur. 1: overflow occurs. 1 s note indicates whether the result of an operation is negative. 0: the result is positive or 0. 1: the result is negative. 0 z indicates whether the result of an operation is 0. 0: the result is not 0. 1: the result is 0. remark also read note on the next page.
chapter 3 cpu function user?s manual u16603ej5v1ud 62 (2/2) note the result of the operation that has performed satura tion processing is determined by the contents of the ov and s flags. the sat flag is set to 1 only when the ov flag is set to 1 when a saturation operation is performed. flag status status of operation result sat ov s result of operation of saturation processing maximum positive value is exceeded 1 1 0 7fffffffh maximum negative value is exceeded 1 1 1 80000000h positive (maximum value is not exceeded) 0 negative (maximum value is not exceeded) holds value before operation 0 1 operation result itself (5) callt execution status saving registers (ctpc and ctpsw) ctpc and ctpsw are callt execut ion status saving registers. when the callt instruction is execut ed, the contents of the program co unter (pc) are saved to ctpc, and those of the program status wo rd (psw) are saved to ctpsw. the contents saved to ctpc are the address of the inst ruction next to callt. the current contents of t he psw are saved to ctpsw. bits 31 to 26 of ctpc and bits 31 to 8 of ctpsw are reserved for future function expansion (fixed to 0). 31 0 ctpc (saved pc contents) 0 0 default value 0xxxxxxxh (x: undefined) 26 25 0 0 0 0 31 0 ctpsw (saved psw contents) 0 0 default value 000000xxh (x: undefined) 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
chapter 3 cpu function user?s manual u16603ej5v1ud 63 (6) exception/debug trap status saving registers (dbpc and dbpsw) dbpc and dbpsw are exception/debug trap status registers. if an exception trap or debug trap occurs, the contents of the program counter (pc) are saved to dbpc, and those of the program status word (psw) are saved to dbpsw. the contents to be saved to dbpc are the address of th e instruction next to the one that is being executed when an exception trap or debug trap occurs. the current contents of t he psw are saved to dbpsw. this register can be read or written only during the in terval between the execution of the dbtrap instruction or illegal opcode and dbret instruction execution. bits 31 to 26 of dbpc and bits 31 to 8 of dbpsw are reserved for future function expansion (fixed to 0). the value of dbpc is restored to the pc and the value of dbpsw to the psw by the dbret instruction. 31 0 dbpc (saved pc contents) 0 0 default value 0xxxxxxxh (x: undefined) 26 25 0 0 0 0 31 0 dbpsw (saved psw contents) 0 0 default value 000000xxh (x: undefined) 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (7) callt base pointer (ctbp) the callt base pointer (ctbp) is used to specify a tabl e address or generate a target address (bit 0 is fixed to 0). bits 31 to 26 of this register are reserved for future function expansion (fixed to 0). 31 0 ctbp (base address) 0 0 default value 0xxxxxxxh (x: undefined) 26 25 0 0 0 0 0
chapter 3 cpu function user?s manual u16603ej5v1ud 64 3.3 operation modes the v850es/sj2 and v850es/sj2-h have the following operation modes. (1) normal operation mode in this mode, each pin related to the bus interface is set to the port mode after system reset has been released. execution branches to the reset entry address of the intern al rom, and then instruction processing is started. (2) flash memory programming mode in this mode, the internal flash memory can be programmed by using a flash memory programmer. the following products are on-chip flash memory versions of the v850es/sj2 and v850es/sj2-h. ? pd70f3264, 70f3264y, 70f3266, 70f3266y, 70f32 74, 70f3274y, 70f3276, 70f3276y, 70f3284, 70f3284y, 70f3286, 70f3286y, 70f3288, 70f3288y, 70f 3266hy, 70f3276hy, 70f3286hy, 70f3288hy (3) on-chip debug mode the v850es/sj2 and v850es/sj2-h are provided with an on-chip debug function that employs the jtag (joint test action group) communicat ion specifications and that is exec uted via an on-chip debug emulator. the on-chip debug function is provided only in the flash memory versions. for details, see chapter 31 on-chip debug function . 3.3.1 specifying operation mode specify the operation mode by using the flmd0 and flmd1 pins. in the normal mode, input a low level to the flmd0/ic pin after the reset status has been released and before the oscillation stabilization time expires and the firmware operation is completed. in the flash memory programming mode, a high level is in put to the flmd0 pin from the flash memory programmer if a flash memory programmer is connected, but it must be input from an external circuit in the self-programming mode. operation when reset is released flmd0 flmd1 operation mode after reset l normal operation mode h l flash memory programming mode h h setting prohibited remark l: low-level input h: high-level input : don?t care
chapter 3 cpu function user?s manual u16603ej5v1ud 65 3.4 address space 3.4.1 cpu address space for instruction addressing, up to a combined total of 16 mb of external memory area and internal rom area, plus an internal ram area, are supported in a linear address space (program space) of up to 64 mb. for operand addressing (data access), up to 4 gb of a linear address spac e (data space) is supported. the 4 gb address space, however, is viewed as 64 images of a 64 mb physical address space. this means that the same 64 mb physical address space is accessed regardless of the value of bits 31 to 26. figure 3-1. image on address space program space internal ram area use-prohibited area use-prohibited area external memory area internal rom area (external memory area) data space image 63 image 1 image 0 peripheral i/o area internal ram area programmable peripheral i/o area or use-prohibited area external memory area internal rom area (external memory area) 16 mb 4 gb 64 mb 64 mb caution only the programmable peripheral i/o area is seen as images of 256 mb each in the 4 gb address space.
chapter 3 cpu function user?s manual u16603ej5v1ud 66 3.4.2 wraparound of cpu address space (1) program space of the 32 bits of the pc (program counter), the higher 6 bits are fixed to 0 and only the lower 26 bits are valid. the higher 6 bits ignore a carry or borrow from bit 25 to 26 during branch address calculation. therefore, the highest address of the program space, 03ffffffh, and t he lowest address, 00000000h, are contiguous addresses. that the highest address and the lowest address of the program space are contiguous in this way is called wraparound. caution because the 4 kb area of addresses 03fff000h to 03ffffffh is an on-chip peripheral i/o area, instructions cannot be fetc hed from this area. therefore , do not execute an operation in which the result of a branch addr ess calculation affects this area. program space program space (+) direction ( ? ) direction 00000001h 00000000h 03ffffffh 03fffffeh (2) data space the result of an operand address calculation oper ation that exceeds 32 bits is ignored. therefore, the highest address of the data space, ffffffffh, and the lowest address, 00000000h, are contiguous, and wraparound occurs at the boundary of these addresses. data space data space (+) direction ( ? ) direction 00000001h 00000000h ffffffffh fffffffeh
chapter 3 cpu function user?s manual u16603ej5v1ud 67 3.4.3 memory map the areas shown below are reserved in the v850es/sj2 and v850es/sj2-h. figure 3-2. data memory map (physical addresses) (80 kb) use prohibited external memory area (14 mb) internal rom area note 4 (1 mb) external memory area (1 mb) internal ram area (60 kb) on-chip peripheral i/o area (4 kb) use prohibited note 1 (2 mb) 03ffffffh 03fec000h 01000000h 00ffffffh 00200000h 001fffffh 00000000h 03febfffh 03ffffffh 03fff000h 03ffefffh 03ff0000h 03feffffh programmable peripheral i/o area note 2 or use prohibited note 3 03fef000h 03feefffh 03fec000h 001fffffh 00100000h 000fffffh 00000000h notes 1. use of addresses 03fef000h to 03feffffh is pr ohibited because these addresses are in the same area as the on-chip peripheral i/o area. 2. only the programmable peripheral i/o area can be viewed in the 4 gb address space as t he image in 256 mb unit. 3. in the can controller version, addresses 03fec000h to 03fecbffh are assigned as a programmable peripheral i/o area in addre sses 03fec000h to 03feefffh. use of these addresses in a version without a can controller is prohibited. 4. fetch access and read access to addresses 000 00000h to 000fffffh is made to the internal rom area. however, data write access to these addresses is made to the external memory area.
chapter 3 cpu function user?s manual u16603ej5v1ud 68 figure 3-3. program memory map internal ram area (60 kb) use prohibited (program fetch prohibited area) use prohibited (program fetch prohibited area) external memory area (14 mb) external memory area (1 mb) internal rom area (1 mb) 03ffffffh 03fff000h 03ffefffh 01000000h 00ffffffh 03ff0000h 03feffffh 00200000h 001fffffh 00100000h 000fffffh 00000000h
chapter 3 cpu function user?s manual u16603ej5v1ud 69 3.4.4 areas (1) internal rom area up to 1 mb is reserved as an internal rom area. (a) internal rom (384 kb) 384 kb mask rom or flash memory is allocated to addresses 0000000 0h to 0005ffffh in the following versions. accessing addresses 00060000h to 000fffffh is prohibited. ? pd703264, 703264y, 703274, 703274y, 703284, 703284y, 70f3264, 70f3264y, 70f3274, 70f3274y, 70f3284, 70f3284y figure 3-4. internal rom area (384 kb) access-prohibited area internal rom (384 kb) 00060000h 0005ffffh 00000000h 000fffffh
chapter 3 cpu function user?s manual u16603ej5v1ud 70 (b) internal rom (512 kb) 512 kb mask rom is allocated to addresses 00000000h to 0007ffffh in the following versions. accessing addresses 00080000h to 000fffffh is prohibited. ? pd703265, 703265y, 703275, 703275y, 703285, 703285y, 703287, 703287y, 703265hy, 703275hy, 703285hy, 703287hy figure 3-5. internal rom area (512 kb) access-prohibited area internal rom (512 kb) 00080000h 0007ffffh 00000000h 000fffffh (c) internal rom (640 kb) 640 kb mask rom or flash memory is allocated to addresses 0000000 0h to 0009ffffh in the following versions. accessing addresses 000a0000h to 000fffffh is prohibited. ? pd703266, 703266y, 703276, 703276y, 703286, 7 03286y, 703288, 703288y, 70f3266, 70f3266y, 70f3276, 70f3276y, 70f3286, 70f 3286y, 70f3288, 70f3288y, 703266hy, 703276hy, 703286hy, 703288hy, 70f3266hy, 70f3276hy, 70f3286hy, 70f3288hy figure 3-6. internal rom area (640 kb) access-prohibited area internal rom (640 kb) 000a0000h 0009ffffh 00000000h 000fffffh
chapter 3 cpu function user?s manual u16603ej5v1ud 71 (2) internal ram area up to 60 kb are reserved as the internal ram area. (a) internal ram (32 kb) 32 kb ram is allocated to addresses 03ff7000h to 03ffefffh of the following versions. accessing addresses 03ff0000h to 03ff6fffh is prohibited. ? pd703264, 703264y, 703274, 703274y, 703284, 703284y, 70f3264, 70f3264y, 70f3274, 70f3274y, 70f3284, 70f3284y figure 3-7. internal ram area (32 kb) access-prohibited area internal ram (32 kb) 03ff7000h 03ff6fffh 03ff0000h 03ffefffh ffff7000h ffff6fffh ffff0000h ffffefffh physical address space logical address space (b) internal ram (40 kb) 40 kb ram is allocated to addresses 03ff5000h to 03ffefffh of the following versions. accessing addresses 03ff0000h to 03ff4fffh is prohibited. ? pd703265, 703265y, 703275, 703275y, 703285, 703285y, 703287, 703287y, 703265hy, 703275hy, 703285hy, 703287hy figure 3-8. internal ram area (40 kb) access-prohibited area internal ram (40 kb) 03ff5000h 03ff4fffh 03ff0000h 03ffefffh ffff5000h ffff4fffh ffff0000h ffffefffh physical address space logical address space
chapter 3 cpu function user?s manual u16603ej5v1ud 72 (c) internal ram (48 kb) 48 kb ram is allocated to addresses 03ff3000h to 03ffefffh of the following versions. accessing addresses 03ff0000h to 03ff2fffh is prohibited. ? pd703266, 703266y, 703276, 703276y, 703286, 7 03286y, 703288, 703288y, 70f3266, 70f3266y, 70f3276, 70f3276y, 70f3286, 70f 3286y, 70f3288, 70f3288y, 703266hy, 703276hy, 703286hy, 703288hy, 70f3266hy, 70f3276hy, 70f3286hy, 70f3288hy figure 3-9. internal ram area (48 kb) access-prohibited area internal ram (48 kb) 03ff3000h 03ff2fffh 03ff0000h 03ffefffh physical address space logical address space ffff3000h ffff2fffh ffff0000h ffffefffh
chapter 3 cpu function user?s manual u16603ej5v1ud 73 (3) on-chip peripheral i/o area 4 kb of addresses 03fff000h to 03ffffffh are re served as the on-chip peripheral i/o area. figure 3-10. on-chip peripheral i/o area on-chip peripheral i/o area (4 kb) 03ffffffh 03fff000h ffffffffh fffff000h physical address space logical address space peripheral i/o registers that have functions to specif y the operation mode for and mo nitor the status of the on- chip peripheral i/o are mapped to the on-chip periphe ral i/o area. program cannot be fetched from this area. cautions 1. when a register is accessed in word units, a word area is accessed twice in halfword units in the order of lower area and higher area, with the lower 2 bits of the address ignored. 2. if a register that can be accessed in byte units is accessed in halfword units, the higher 8 bits are undefined when the register is read , and data is written to the lower 8 bits. 3. addresses not defined as registers are r eserved for future expansion. the operation is undefined and not guaranteed when these addresses are accessed. 4. the internal rom/ram area and on-chip peripheral i/o area are assigned to successive addresses. when accessing the internal rom/ram area by incrementi ng or decrementing addresses using pointer operations and such, therefore, be careful not to access the on-chip peripheral i/o area by mistakenly extendi ng over the internal rom/ram area boundary.
chapter 3 cpu function user?s manual u16603ej5v1ud 74 (4) programmable peripheral i/o area cautions 1. the programmable peripheral i/o area exists only in the can controller versions. this area cannot be used with products that are not equipped with the can controller. 2. only the programmable peripheral i/o area is seen as images of 256 mb each in the 4 gb address space. 12 kb of addresses 03fec000h to 03feefffh are rese rved as the programmable peripheral i/o area. figure 3-11. programmable peripheral i/o area programmable peripheral i/o area (12 kb) 03feefffh 03fec000h (5) external memory area 15 mb (00100000h to 00ffffffh) are allocated as th e external memory area. for details, see chapter 5 bus control function .
chapter 3 cpu function user?s manual u16603ej5v1ud 75 3.4.5 recommended use of address space the architecture of the v850es/sj2 a nd v850es/sj2-h requires that a regist er that serves as a pointer be secured for address generation when operand data in the data space is accessed. the address stored in this pointer 32 kb can be directly accessed by an instruction for operand data. because the number of general-purpose registers that can be used as a pointer is limited, however, by keeping the performance from dropping during address calculation when a pointer value is changed, as many gen eral-purpose registers as possible can be secured for variables, and the program size can be reduced. (1) program space of the 32 bits of the pc (program counte r), the higher 6 bits are fixed to 0, and only the lower 26 bits are valid. regarding the program space, therefore, a 64 mb spac e of contiguous addresses starting from 00000000h unconditionally corresponds to the memory map. to use the internal ram area as the prog ram space, access the following addresses. caution if a branch instruction is at the upper limi t of the internal ram ar ea, a prefetch operation (invalid fetch) straddling the on-chip peripheral i/o area does not occur. ram size access address 48 kb 03ff3000h to 03ffefffh 40 kb 03ff5000h to 03ffefffh 32 kb 03ff7000h to 03ffefffh (2) data space with the v850es/sj2 and v850es/sj2-h, it seems that there are sixty-f our 64 mb address spaces on the 4 gb cpu address space. therefore, the least significant bi t (bit 25) of a 26-bit address is sign-extended to 32 bits and allocated as an address. (a) application example of wraparound if r = r0 (zero register) is specified for the ld/st di sp16 [r] instruction, a range of addresses 00000000h 32 kb can be addressed by sign-extended disp16. all the resources, including the internal hardware, can be addressed by one pointer. the zero register (r0) is a register fixed to 0 by har dware, and practically eliminates the need for registers dedicated to pointers. example pd703264y internal rom area on-chip peripheral i/o area internal ram area 3 2 kb 4 kb 28 kb (r = ) 00007fffh 00000000h fffff000h ffffefffh ffffffffh ffff8000h
chapter 3 cpu function user?s manual u16603ej5v1ud 76 figure 3-12. recommended memory map data space program space on-chip peripheral i/o on-chip peripheral i/o internal ram internal ram internal rom external memory use prohibited external memory use prohibited note internal ram program space 64 mb internal rom internal rom ffffffffh fffff000h ffffefffh ffff0000h fffeffffh 04000000h 03ffffffh 03fff000h 03ffefffh 03ff3000h 03ff2fffh 03ff0000h 03feffffh 01000000h 00ffffffh 000a0000h 0009ffffh 00100000h 000fffffh 00000000h ffffffffh fffff000h ffffefffh ffff3000h ffff2fffh ffff0000h fffeffffh 00100000h 000fffffh 00000000h use prohibited note in the can controller version, the data space of addresses 03fec0 00h to 03feefffh is assigned as the programmable peripheral i/o area. only the prog rammable peripheral i/o area is seen as images of 256 mb each in the 4 gb address space. remarks 1. indicates the recommended area. 2. this figure is the recommended memory map of the pd703266hy.
chapter 3 cpu function user?s manual u16603ej5v1ud 77 3.4.6 peripheral i/o registers (1/13) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff004h port dl register pdl 0000h note 1 fffff004h port dll register pdll 00h note 1 fffff005h port dlh register pdlh 00h note 1 fffff006h port dh register pdh 00h note 1 fffff008h port cs register pcs 00h note 1 fffff00ah port ct register pct 00h note 1 fffff00ch port cm register pcm 00h note 1 fffff00eh port cd register pcd 00h note 1 fffff024h port dl mode register pmdl ffffh fffff024h port dl mode register l pmdll ffh fffff025h port dl mode register h pmdlh ffh fffff026h port dh mode register pmdh ffh fffff028h port cs mode register pmcs ffh fffff02ah port ct mode register pmct ffh fffff02ch port cm mode register pmcm ffh fffff02eh port cd mode register pmcd ffh fffff044h port dl mode control register pmcdl 0000h fffff044h port dl mode control register l pmcdll 00h fffff045h port dl mode control register h pmcdlh 00h fffff046h port dh mode control register pmcdh 00h fffff048h port cs mode control register pmccs 00h fffff04ah port ct mode control register pmcct 00h fffff04ch port cm mode control register pmccm 00h fffff064h peripheral i/o area select control register bpc note 2 0000h fffff066h bus size configuration register bsc 5555h fffff06eh system wait control register vswc 77h fffff080h dma source addres s register 0l dsa0l undefined fffff082h dma source address register 0h dsa0h undefined fffff084h dma destination address register 0l dda0l undefined fffff086h dma destination address register 0h dda0h undefined fffff088h dma source addres s register 1l dsa1l undefined fffff08ah dma source addres s register 1h dsa1h undefined fffff08ch dma destination address register 1l dda1l undefined fffff08eh dma destination address register 1h dda1h undefined fffff090h dma source addres s register 2l dsa2l undefined fffff092h dma source address register 2h dsa2h undefined fffff094h dma destination address register 2l dda2l undefined fffff096h dma destination address register 2h dda2h undefined fffff098h dma source addres s register 3l dsa3l undefined fffff09ah dma source addr ess register 3h dsa3h r/w undefined notes 1. the output latch is 00h or 0000h. when these regist ers are in the input mode, the pin statuses are read. 2. can controller versions only
chapter 3 cpu function user?s manual u16603ej5v1ud 78 (2/13) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff09ch dma destination address register 3l dda3l undefined fffff09eh dma destination address register 3h dda3h undefined fffff0c0h dma transfer count register 0 dbc0 undefined fffff0c2h dma transfer count register 1 dbc1 undefined fffff0c4h dma transfer count register 2 dbc2 undefined fffff0c6h dma transfer count register 3 dbc3 undefined fffff0d0h dma addressing control register 0 dadc0 0000h fffff0d2h dma addressing control register 1 dadc1 0000h fffff0d4h dma addressing control register 2 dadc2 0000h fffff0d6h dma addressing control register 3 dadc3 0000h fffff0e0h dma channel control register 0 dchc0 00h fffff0e2h dma channel control register 1 dchc1 00h fffff0e4h dma channel control register 2 dchc2 00h fffff0e6h dma channel control register 3 dchc3 00h fffff100h interrupt mask register 0 imr0 ffffh fffff100h interrupt mask register 0l imr0l ffh fffff101h interrupt mask register 0h imr0h ffh fffff102h interrupt mask register 1 imr1 ffffh fffff102h interrupt mask register 1l imr1l ffh fffff103h interrupt mask register 1h imr1h ffh fffff104h interrupt mask register 2 imr2 ffffh fffff104h interrupt mask register 2l imr2l ffh fffff105h interrupt mask register 2h imr2h ffh fffff106h interrupt mask register 3 imr3 ffffh fffff106h interrupt mask register 3l imr3l ffh fffff107h interrupt mask register 3h imr3h ffh fffff108h interrupt mask register 4 imr4 ffffh fffff108h interrupt mask register 4l imr4l ffh fffff109h interrupt mask register 4h imr4h ffh fffff110h interrupt control register lviic note 47h fffff112h interrupt control register pic0 47h fffff114h interrupt control register pic1 47h fffff116h interrupt control register pic2 47h fffff118h interrupt control register pic3 47h fffff11ah interrupt control register pic4 47h fffff11ch interrupt control register pic5 47h fffff11eh interrupt control register pic6 47h fffff120h interrupt control register pic7 47h fffff122h interrupt control register tq0ovic 47h fffff124h interrupt control register tq0ccic0 47h fffff126h interrupt control register tq0ccic1 47h fffff128h interrupt control register tq0ccic2 r/w 47h note v850es/sj2 versions only
chapter 3 cpu function user?s manual u16603ej5v1ud 79 (3/13) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff12ah interrupt control register tq0ccic3 47h fffff12ch interrupt control register tp0ovic 47h fffff12eh interrupt control register tp0ccic0 47h fffff130h interrupt control register tp0ccic1 47h fffff132h interrupt control register tp1ovic 47h fffff134h interrupt control register tp1ccic0 47h fffff136h interrupt control register tp1ccic1 47h fffff138h interrupt control register tp2ovic 47h fffff13ah interrupt control register tp2ccic0 47h fffff13ch interrupt control register tp2ccic1 47h fffff13eh interrupt control register tp3ovic 47h fffff140h interrupt control register tp3ccic0 47h fffff142h interrupt control register tp3ccic1 47h fffff144h interrupt control register tp4ovic 47h fffff146h interrupt control register tp4ccic0 47h fffff148h interrupt control register tp4ccic1 47h fffff14ah interrupt control register tp5ovic 47h fffff14ch interrupt control register tp5ccic0 47h fffff14eh interrupt control register tp5ccic1 47h fffff150h interrupt control register tm0eqic0 47h fffff1 52 h interrupt control register cb0ric/iicic1 note 47h fffff1 54 h interrupt control register cb0tic 47h fffff156h interrupt control register cb1ric 47h fffff158h interrupt control register cb1tic 47h fffff15ah interrupt control register cb2ric 47h fffff15ch interrupt control register cb2tic 47h fffff15eh interrupt control register cb3ric 47h fffff160h interrupt control register cb3tic 47h fffff162h interrupt control register ua0ric/cb4ric 47h fffff164h interrupt control register ua0tic/cb4tic 47h fffff166h interrupt control register ua1ric/iicic2 note 47h fffff168h interrupt control register ua1tic 47h fffff16ah interrupt control register ua2ric/iicic0 note 47h fffff16ch interrupt control register ua2tic 47h fffff16eh interrupt control register adic 47h fffff170h interrupt control register dmaic0 47h fffff172h interrupt control register dmaic1 47h fffff174h interrupt control register dmaic2 47h fffff176h interrupt control register dmaic3 47h fffff178h interrupt control register kric 47h fffff17ah interrupt control register wtiic 47h fffff17ch interrupt control register wtic r/w 47h note i 2 c bus versions (y products) only
chapter 3 cpu function user?s manual u16603ej5v1ud 80 (4/13) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff17eh interrupt control register erric0 note 1 / erric note 2 47h fffff180h interrupt control register wupic0 note 1 / staic note 2 47h fffff182h interrupt control register recic0 note 1 / ieic1 note 2 47h fffff184h interrupt control register trxic0 note 1 / ieic2 note 2 47h fffff186h interrupt control register erric1 note 3 47h fffff188h interrupt control register wupic1 note 3 47h fffff18ah interrupt control register recic1 note 3 47h fffff18ch interrupt control register trxic1 note 3 47h fffff18eh interrupt control register pic8 47h fffff190h interrupt control register tp6ovic 47h fffff192h interrupt control register tp6ccic0 47h fffff194h interrupt control register tp6ccic1 47h fffff196h interrupt control register tp7ovic 47h fffff198h interrupt control register tp7ccic0 47h fffff19ah interrupt control register tp7ccic1 47h fffff19ch interrupt control register tp8ovic 47h fffff19eh interrupt control register tp8ccic0 47h fffff1a0h interrupt control register tp8ccic1 47h fffff1a2h interrupt control register cb5ric 47h fffff1a4h interrupt control register cb5tic 47h fffff1a6h interrupt control register ua3ric 47h fffff1a8h interrupt control register ua3tic r/w 47h fffff1fah in-service priority register ispr r 00h fffff1fch command register prcmd w undefined fffff1feh power save control register psc 00h fffff200h a/d converter mode register 0 ada0m0 00h fffff201h a/d converter mode register 1 ada0m1 00h fffff202h a/d converter channel specification register ada0s 00h fffff203h a/d converter mode register 2 ada0m2 00h fffff204h power-fail compare mode register ada0pfm 00h fffff205h power-fail compare threshold value register ada0pft r/w 00h fffff210h a/d conversion result register 0 ada0cr0 undefined fffff211h a/d conversion result register 0h ada0cr0h undefined fffff212h a/d conversion result register 1 ada0cr1 undefined fffff213h a/d conversion result register 1h ada0cr1h undefined fffff214h a/d conversion result register 2 ada0cr2 undefined fffff215h a/d conversion result register 2h ada0cr2h undefined fffff216h a/d conversion result register 3 ada0cr3 undefined fffff217h a/d conversion result register 3h ada0cr3h r undefined notes 1. can controller versions only 2. iebus controller versions only 3. can controller (2-channel) versions only
chapter 3 cpu function user?s manual u16603ej5v1ud 81 (5/13) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff218h a/d conversion result register 4 ada0cr4 undefined fffff219h a/d conversion result register 4h ada0cr4h undefined fffff21ah a/d conversion result register 5 ada0cr5 undefined fffff21bh a/d conversion result register 5h ada0cr5h undefined fffff21ch a/d conversion result register 6 ada0cr6 undefined fffff21dh a/d conversion result register 6h ada0cr6h undefined fffff21eh a/d conversion result register 7 ada0cr7 undefined fffff21fh a/d conversion result register 7h ada0cr7h undefined fffff220h a/d conversion result register 8 ada0cr8 undefined fffff221h a/d conversion result register 8h ada0cr8h undefined fffff222h a/d conversion result register 9 ada0cr9 undefined fffff223h a/d conversion result register 9h ada0cr9h undefined fffff224h a/d conversion result register 10 ada0cr10 undefined fffff225h a/d conversion result register 10h ada0cr10h undefined fffff226h a/d conversion result register 11 ada0cr11 undefined fffff227h a/d conversion result register 11h ada0cr11h undefined fffff228h a/d conversion result register 12 ada0cr12 undefined fffff229h a/d conversion result register 12h ada0cr12h undefined fffff22ah a/d conversion result register 13 ada0cr13 undefined fffff22bh a/d conversion result register 13h ada0cr13h undefined fffff22ch a/d conversion result register 14 ada0cr14 undefined fffff22dh a/d conversion result register 14h ada0cr14h undefined fffff22eh a/d conversion result register 15 ada0cr15 undefined fffff22fh a/d conversion result register 15h ada0cr15h undefined fffff280h d/a converter conversion va lue setting register 0 da0cs0 00h fffff281h d/a converter conversion va lue setting register 1 da0cs1 00h fffff282h d/a converter mode register da0m 00h fffff300h key return mode register krm 00h fffff308h selector operation control register 0 selcnt0 00h fffff310h crc input register crcin 00h fffff312h crc data register crcd 0000h fffff318h noise elimination control register nfc 00h fffff320h brg1 prescaler mode register prsm1 00h fffff321h brg1 prescaler compare register prscm1 00h fffff324h brg2 prescaler mode register prsm2 00h fffff325h brg2 prescaler compare register prscm2 00h fffff328h brg3 prescaler mode register prsm3 00h fffff329h brg3 prescaler compare register prscm3 00h fffff340h iic division clock select register ocks0 note 1 00h fffff344h iic division clock select register ocks1 note 1 00h fffff348h iebus clock select register ocks2 note 2 r/w 00h notes 1. i 2 c bus versions (y products) only 2. iebus controller versions only
chapter 3 cpu function user?s manual u16603ej5v1ud 82 (6/13) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff360h iebus control register bcr note 1 00h fffff361h iebus power save register psr note 1 r/w 00h fffff362h iebus slave status register ssr note 1 81h fffff363h iebus unit status register usr note 1 r 00h fffff364h iebus interrupt status register isr note 1 00h fffff365h iebus error status register esr note 1 00h fffff366h iebus unit address register uar note 1 0000h fffff368h iebus slave address register sar note 1 r/w 0000h fffff36ah iebus partner address register par note 1 0000h fffff36ch iebus receive slave address register rsa note 1 r 0000h fffff36eh iebus control data register cdr note 1 00h fffff36fh iebus telegraph length register dlr note 1 01h fffff370h iebus data register dr note 1 r/w 00h fffff371h iebus field status register fsr note 1 00h fffff372h iebus success count register scr note 1 01h fffff373h iebus communication count register ccr note 1 r 20h fffff400h port 0 register p0 00h note 2 fffff402h port 1 register p1 00h note 2 fffff406h port 3 register p3 0000h note 2 fffff406h port 3 register l p3l 00h note 2 fffff407h port 3 register h p3h 00h note 2 fffff408h port 4 register p4 00h note 2 fffff40ah port 5 register p5 00h note 2 fffff40ch port 6 register p6 0000h note 2 fffff40ch port 6 register l p6l 00h note 2 fffff40dh port 6 register h p6h 00h note 2 fffff40eh port 7 register l p7l 00h note 2 fffff40fh port 7 register h p7h 00h note 2 fffff410h port 8 register p8 00h note 2 fffff412h port 9 register p9 0000h note 2 fffff412h port 9 register l p9l 00h note 2 fffff413h port 9 register h p9h 00h note 2 fffff420h port 0 mode register pm0 ffh fffff422h port 1 mode register pm1 ffh fffff426h port 3 mode register pm3 ffffh fffff426h port 3 mode register l pm3l ffh fffff427h port 3 mode register h pm3h ffh fffff428h port 4 mode register pm4 ffh fffff42ah port 5 mode register pm5 r/w ffh notes 1. iebus controller versions only 2. the output latch is 00h or 0000h. when these registers are input, the pin statuses are read.
chapter 3 cpu function user?s manual u16603ej5v1ud 83 (7/13) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff42ch port 6 mode register pm6 ffffh fffff42ch port 6 mode register l pm6l ffh fffff42dh port 6 mode register h pm6h ffh fffff42eh port 7 mode register l pm7l ffh fffff42fh port 7 mode register h pm7h ffh fffff430h port 8 mode register pm8 ffh fffff432h port 9 mode register pm9 ffffh fffff432h port 9 mode register l pm9l ffh fffff433h port 9 mode register h pm9h ffh fffff440h port 0 mode control register pmc0 00h fffff446h port 3 mode control register pmc3 0000h fffff446h port 3 mode control register l pmc3l 00h fffff447h port 3 mode control register h pmc3h 00h fffff448h port 4 mode control register pmc4 00h fffff44ah port 5 mode control register pmc5 00h fffff44ch port 6 mode control register pmc6 0000h fffff44ch port 6 mode control register l pmc6l 00h fffff44dh port 6 mode control register h pmc6h 00h fffff450h port 8 mode control register pmc8 00h fffff452h port 9 mode control register pmc9 0000h fffff452h port 9 mode control register l pmc9l 00h fffff453h port 9 mode control register h pmc9h 00h fffff460h port 0 function control register pfc0 00h fffff466h port 3 function control register pfc3 0000h fffff466h port 3 function control register l pfc3l 00h fffff467h port 3 function control register h pfc3h 00h fffff468h port 4 function control register pfc4 00h fffff46ah port 5 function control register pfc5 00h fffff46dh port 6 function control register h pfc6h 00h fffff472h port 9 function control register pfc9 0000h fffff472h port 9 function control register l pfc9l 00h fffff473h port 9 function control register h pfc9h 00h fffff484h data wait control register 0 dwc0 7777h fffff488h address wait control register awc ffffh fffff48ah bus cycle control register bcc aaaah fffff540h tmq0 control register 0 tq0ctl0 00h fffff541h tmq0 control register 1 tq0ctl1 00h fffff542h tmq0 i/o control register 0 tq0ioc0 00h fffff543h tmq0 i/o control register 1 tq0ioc1 00h fffff544h tmq0 i/o control register 2 tq0ioc2 00h fffff545h tmq0 option register 0 tq0opt0 00h fffff546h tmq0 capture/compare register 0 tq0ccr0 0000h fffff548h tmq0 capture/compare register 1 tq0ccr1 r/w 0000h
chapter 3 cpu function user?s manual u16603ej5v1ud 84 (8/13) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff54ah tmq0 capture/compare register 2 tq0ccr2 0000h fffff54ch tmq0 capture/compare register 3 tq0ccr3 r/w 0000h fffff54eh tmq0 counter read buffer register tq0cnt r 0000h fffff590h tmp0 control register 0 tp0ctl0 00h fffff591h tmp0 control register 1 tp0ctl1 00h fffff592h tmp0 i/o control register 0 tp0ioc0 00h fffff593h tmp0 i/o control register 1 tp0ioc1 00h fffff594h tmp0 i/o control register 2 tp0ioc2 00h fffff595h tmp0 option register 0 tp0opt0 00h fffff596h tmp0 capture/compare register 0 tp0ccr0 0000h fffff598h tmp0 capture/compare register 1 tp0ccr1 r/w 0000h fffff59ah tmp0 counter read buffer register tp0cnt r 0000h fffff5a0h tmp1 control register 0 tp1ctl0 00h fffff5a1h tmp1 control register 1 tp1ctl1 00h fffff5a2h tmp1 i/o control register 0 tp1ioc0 00h fffff5a3h tmp1 i/o control register 1 tp1ioc1 00h fffff5a4h tmp1 i/o control register 2 tp1ioc2 00h fffff5a5h tmp1 option register 0 tp1opt0 00h fffff5a6h tmp1 capture/compare register 0 tp1ccr0 0000h fffff5a8h tmp1 capture/compare register 1 tp1ccr1 r/w 0000h fffff5aah tmp1 counter read buffer register tp1cnt r 0000h fffff5b0h tmp2 control register 0 tp2ctl0 00h fffff5b1h tmp2 control register 1 tp2ctl1 00h fffff5b2h tmp2 i/o control register 0 tp2ioc0 00h fffff5b3h tmp2 i/o control register 1 tp2ioc1 00h fffff5b4h tmp2 i/o control register 2 tp2ioc2 00h fffff5b5h tmp2 option register 0 tp2opt0 00h fffff5b6h tmp2 capture/compare register 0 tp2ccr0 0000h fffff5b8h tmp2 capture/compare register 1 tp2ccr1 r/w 0000h fffff5bah tmp2 counter read buffer register tp2cnt r 0000h fffff5c0h tmp3 control register 0 tp3ctl0 00h fffff5c1h tmp3 control register 1 tp3ctl1 00h fffff5c2h tmp3 i/o control register 0 tp3ioc0 00h fffff5c3h tmp3 i/o control register 1 tp3ioc1 00h fffff5c4h tmp3 i/o control register 2 tp3ioc2 00h fffff5c5h tmp3 option register 0 tp3opt0 00h fffff5c6h tmp3 capture/compare register 0 tp3ccr0 0000h fffff5c8h tmp3 capture/compare register 1 tp3ccr1 r/w 0000h fffff5cah tmp3 counter read buffer register tp3cnt r 0000h fffff5d0h tmp4 control register 0 tp4ctl0 00h fffff5d1h tmp4 control register 1 tp4ctl1 00h fffff5d2h tmp4 i/o control register 0 tp4ioc0 00h fffff5d3h tmp4 i/o control register 1 tp4ioc1 r/w 00h
chapter 3 cpu function user?s manual u16603ej5v1ud 85 (9/13) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff5d4h tmp4 i/o control register 2 tp4ioc2 00h fffff5d5h tmp4 option register 0 tp4opt0 00h fffff5d6h tmp4 capture/compare register 0 tp4ccr0 0000h fffff5d8h tmp4 capture/compare register 1 tp4ccr1 r/w 0000h fffff5dah tmp4 counter read buffer register tp4cnt r 0000h fffff5e0h tmp5 control register 0 tp5ctl0 00h fffff5e1h tmp5 control register 1 tp5ctl1 00h fffff5e2h tmp5 i/o control register 0 tp5ioc0 00h fffff5e3h tmp5 i/o control register 1 tp5ioc1 00h fffff5e4h tmp5 i/o control register 2 tp5ioc2 00h fffff5e5h tmp5 option register 0 tp5opt0 00h fffff5e6h tmp5 capture/compare register 0 tp5ccr0 0000h fffff5e8h tmp5 capture/compare register 1 tp5ccr1 r/w 0000h fffff5eah tmp5 counter read buffer register tp5cnt r 0000h fffff5f0h tmp6 control register 0 tp6ctl0 00h fffff5f1h tmp6 control register 1 tp6ctl1 00h fffff5f2h tmp6 i/o control register 0 tp6ioc0 00h fffff5f3h tmp6 i/o control register 1 tp6ioc1 00h fffff5f4h tmp6 i/o control register 2 tp6ioc2 00h fffff5f5h tmp6 option register 0 tp6opt0 00h fffff5f6h tmp6 capture/compare register 0 tp6ccr0 0000h fffff5f8h tmp6 capture/compare register 1 tp6ccr1 r/w 0000h fffff5fah tmp6 counter read buffer register tp6cnt r 0000h fffff600h tmp7 control register 0 tp7ctl0 00h fffff601h tmp7 control register 1 tp7ctl1 00h fffff602h tmp7 i/o control register 0 tp7ioc0 00h fffff603h tmp7 i/o control register 1 tp7ioc1 00h fffff604h tmp7 i/o control register 2 tp7ioc2 00h fffff605h tmp7 option register 0 tp7opt0 00h fffff606h tmp7 capture/compare register 0 tp7ccr0 0000h fffff608h tmp7 capture/compare register 1 tp7ccr1 r/w 0000h fffff60ah tmp7 counter read buffer register tp7cnt r 0000h fffff610h tmp8 control register 0 tp8ctl0 00h fffff611h tmp8 control register 1 tp8ctl1 00h fffff612h tmp8 i/o control register 0 tp8ioc0 00h fffff613h tmp8 i/o control register 1 tp8ioc1 00h fffff614h tmp8 i/o control register 2 tp8ioc2 00h fffff615h tmp8 option register 0 tp8opt0 00h fffff616h tmp8 capture/compare register 0 tp8ccr0 0000h fffff618h tmp8 capture/compare register 1 tp8ccr1 r/w 0000h fffff61ah tmp8 counter read buffer register tp8cnt r 0000h fffff680h watch timer operation mode register wtm 00h fffff690h tmm0 control register 0 tm0ctl0 r/w 00h
chapter 3 cpu function user?s manual u16603ej5v1ud 86 (10/13) manipulatable bits address function register name symbol r/w 1 8 16 32 default value fffff694h tmm0 compare register 0 tm0cmp0 0000h fffff6c0h oscillation stabilization time select register osts 06h fffff6c1h pll lockup time specification register plls 03h fffff6d0h watchdog timer mode register 2 wdtm2 67h fffff6d1h watchdog timer enable register wdte 9ah fffff6e0h real-time output buffer register 0l rtbl0 00h fffff6e2h real-time output buffer register 0h rtbh0 00h fffff6e4h real-time output port mode register 0 rtpm0 00h fffff6e5h real-time output port control register 0 rtpc0 00h fffff6f0h real-time output buffer register 1l rtbl1 00h fffff6f2h real-time output buffer register 1h rtbh1 00h fffff6f4h real-time output port mode register 1 rtpm1 00h fffff6f5h real-time output port control register 1 rtpc1 00h fffff706h port 3 function control expansion register l pfce3l 00h fffff70ah port 5 function control expansion register pfce5 00h fffff712h port 9 function control expansion register pfce9 0000h fffff712h port 9 function control expansion register l pfce9l 00h fffff713h port 9 function control expansion register h pfce9h 00h fffff802h system status register sys 00h fffff80ch internal oscillation mode register rcm 00h fffff810h dma trigger factor register 0 dtfr0 00h fffff812h dma trigger factor register 1 dtfr1 00h fffff814h dma trigger factor register 2 dtfr2 00h fffff816h dma trigger factor register 3 dtfr3 00h fffff820h power save mode register psmr 00h fffff822h clock control register ckc r/w 0ah fffff824h lock register lockr r 00h fffff828h processor clock control register pcc 03h fffff82ch pll control register pllctl r/w 01h fffff82eh cpu operation clock status register ccls r 00h fffff840h correction address register 0 corad0 00000000h fffff840h correction address register 0l corad0l 0000h fffff842h correction address register 0h corad0h 0000h fffff844h correction address register 1 corad1 00000000h fffff844h correction address register 1l corad1l 0000h fffff846h correction address register 1h corad1h 0000h fffff848h correction address register 2 corad2 00000000h fffff848h correction address register 2l corad2l 0000h fffff84ah correction address register 2h corad2h 0000h fffff84ch correction address register 3 corad3 00000000h fffff84ch correction address register 3l corad3l 0000h fffff84eh correction address register 3h corad3h 0000h fffff870h clock monitor mode register clm r/w 00h
chapter 3 cpu function user?s manual u16603ej5v1ud 87 (11/13) manipulatable bits address function register name symbol r/w 1 8 16 32 default value fffff880h correction control register corcn 00h fffff888h reset source flag register resf 00h fffff890h low voltage detection register lvim note 1 00h fffff891h low voltage detection level select register lvis note 1 00h fffff892h internal ram data status register rams 01h fffff8b0h prescaler mode register 0 prsm0 00h fffff8b1h prescaler compare register 0 prscm0 00h fffff9fch on-chip debug mode register ocdm 01h fffff9feh peripheral emul ation register 1 pemu1 note 2 00h fffffa00h uarta0 control register 0 ua0ctl0 10h fffffa01h uarta0 control register 1 ua0ctl1 00h fffffa02h uarta0 control register 2 ua0ctl2 ffh fffffa03h uarta0 option control register 0 ua0opt0 14h fffffa04h uarta0 status register ua0str r/w 00h fffffa06h uarta0 receive data register ua0rx r ffh fffffa07h uarta0 transmit data register ua0tx ffh fffffa10h uarta1 control register 0 ua1ctl0 10h fffffa11h uarta1 control register 1 ua1ctl1 00h fffffa12h uarta1 control register 2 ua1ctl2 ffh fffffa13h uarta1 option control register 0 ua1opt0 14h fffffa14h uarta1 status register ua1str r/w 00h fffffa16h uarta1 receive data register ua1rx r ffh fffffa17h uarta1 transmit data register ua1tx ffh fffffa20h uarta2 control register 0 ua2ctl0 10h fffffa21h uarta2 control register 1 ua2ctl1 00h fffffa22h uarta2 control register 2 ua2ctl2 ffh fffffa23h uarta2 option control register 0 ua2opt0 14h fffffa24h uarta2 status register ua2str r/w 00h fffffa26h uarta2 receive data register ua2rx r ffh fffffa27h uarta2 transmit data register ua2tx ffh fffffa30h uarta3 control register 0 ua3ctl0 10h fffffa31h uarta3 control register 1 ua3ctl1 00h fffffa32h uarta3 control register 2 ua3ctl2 ffh fffffa33h uarta3 option control register 0 ua3opt0 14h fffffa34h uarta3 status register ua3str r/w 00h fffffa36h uarta3 receive data register ua3rx r ffh fffffa37h uarta3 transmit data register ua3tx ffh fffffc00h external interrupt falling edge specification register 0 intf0 00h fffffc06h external interrupt falling edge specification register 3 intf3 00h fffffc10h external interrupt falling edge specification register 8 intf8 00h fffffc13h external interrupt falling edge specification register 9h intf9h r/w 00h notes 1. v850es/sj2 only 2. only during emulation
chapter 3 cpu function user?s manual u16603ej5v1ud 88 (12/13) manipulatable bits address function register name symbol r/w 1 8 16 default value fffffc20h external interrupt rising edge specification register 0 intr0 00h fffffc26h external interrupt rising edge specification register 3 intr3 00h fffffc30h external interrupt rising edge specification register 8 intr8 00h fffffc33h external interrupt rising edge specification register 9h intr9h 00h fffffc60h port 0 function register pf0 00h fffffc66h port 3 function register pf3 0000h fffffc66h port 3 function register l pf3l 00h fffffc67h port 3 function register h pf3h 00h fffffc68h port 4 function register pf4 00h fffffc6ah port 5 function register pf5 00h fffffc6ch port 6 function register pf6 0000h fffffc6ch port 6 function register l pf6l 00h fffffc6dh port 6 function register h pf6h 00h fffffc70h port 8 function register pf8 00h fffffc72h port 9 function register pf9 0000h fffffc72h port 9 function register l pf9l 00h fffffc73h port function 9 control register h pf9h 00h fffffd00h csib0 control register 0 cb0ctl0 01h fffffd01h csib0 control register 1 cb0ctl1 00h fffffd02h csib0 control register 2 cb0ctl2 00h fffffd03h csib0 status register cb0str r/w 00h fffffd04h csib0 receive data register cb0rx 0000h fffffd04h csib0 receive data register l cb0rxl r 00h fffffd06h csib0 transmit data register cb0tx 0000h fffffd06h csib0 transmit data register l cb0txl 00h fffffd10h csib1 control register 0 cb1ctl0 01h fffffd11h csib1 control register 1 cb1ctl1 00h fffffd12h csib1 control register 2 cb1ctl2 00h fffffd13h csib1 status register cb1str r/w 00h fffffd14h csib1 receive data register cb1rx 0000h fffffd14h csib1 receive data register l cb1rxl r 00h fffffd16h csib1 transmit data register cb1tx 0000h fffffd16h csib1 transmit data register l cb1txl 00h fffffd20h csib2 control register 0 cb2ctl0 01h fffffd21h csib2 control register 1 cb2ctl1 00h fffffd22h csib2 control register 2 cb2ctl2 00h fffffd23h csib2 status register cb2str r/w 00h fffffd24h csib2 receive data register cb2rx 0000h fffffd24h csib2 receive data register l cb2rxl r 00h fffffd26h csib2 transmit data register cb2tx 0000h fffffd26h csib2 transmit data register l cb2txl 00h fffffd30h csib3 control register 0 cb3ctl0 01h fffffd31h csib3 control register 1 cb3ctl1 r/w 00h
chapter 3 cpu function user?s manual u16603ej5v1ud 89 (13/13) manipulatable bits address function register name symbol r/w 1 8 16 default value fffffd32h csib3 control register 2 cb3ctl2 00h fffffd33h csib3 status register cb3str r/w 00h fffffd34h csib3 receive data register cb3rx 0000h fffffd34h csib3 receive data register l cb3rxl r 00h fffffd36h csib3 transmit data register cb3tx 0000h fffffd36h csib3 transmit data register l cb3txl 00h fffffd40h csib4 control register 0 cb4ctl0 01h fffffd41h csib4 control register 1 cb4ctl1 00h fffffd42h csib4 control register 2 cb4ctl2 00h fffffd43h csib4 status register cb4str r/w 00h fffffd44h csib4 receive data register cb4rx 0000h fffffd44h csib4 receive data register l cb4rxl r 00h fffffd46h csib4 transmit data register cb4tx 0000h fffffd46h csib4 transmit data register l cb4txl 00h fffffd50h csib5 control register 0 cb5ctl0 01h fffffd51h csib5 control register 1 cb5ctl1 00h fffffd52h csib5 control register 2 cb5ctl2 00h fffffd53h csib5 status register cb5str r/w 00h fffffd54h csib5 receive data register cb5rx 0000h fffffd54h csib5 receive data register l cb5rxl r 00h fffffd56h csib5 transmit data register cb5tx 0000h fffffd56h csib5 transmit data register l cb5txl 00h fffffd80h iic shift register 0 note iic0 00h fffffd82h iic control register 0 note iicc0 00h fffffd83h slave address register 0 note sva0 00h fffffd84h iic clock select register 0 note iiccl0 00h fffffd85h iic function expansion register 0 note iicx0 r/w 00h fffffd86h iic status register 0 note iics0 r 00h fffffd8ah iic flag register 0 note iicf0 00h fffffd90h iic shift register 1 note iic1 00h fffffd92h iic control register 1 note iicc1 00h fffffd93h slave address register 1 note sva1 00h fffffd94h iic clock select register 1 note iiccl1 00h fffffd95h iic function expansion register 1 note iicx1 r/w 00h fffffd96h iic status register 1 note iics1 r 00h fffffd9ah iic flag register 1 note iicf1 00h fffffda0h iic shift register 2 note iic2 00h fffffda2h iic control register 2 note iicc2 00h fffffda3h slave address register 2 note sva2 00h fffffda4h iic clock select register 2 note iiccl2 00h fffffda5h iic function expansion register 2 note iicx2 r/w 00h fffffda6h iic status register 2 note iics2 r 00h fffffdaah iic flag register 2 note iicf2 00h ffffffbeh external bus interface mode control register eximc r/w 00h note i 2 c bus versions (y products) only
chapter 3 cpu function user?s manual u16603ej5v1ud 90 3.4.7 programmable peripheral i/o registers the bpc register is used for programmable peripheral i/o register area selection. (1) peripheral i/o area selec t control register (bpc) the bpc register can be read or written in 16-bit units. reset sets this register to 0000h. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 address default value bpc pa15 0 pa13 pa12 pa11 pa10 pa09 pa08 pa07 pa06 pa05 pa04 pa03 pa02 pa01 pa00 fffff064h 0000h bit position bit name function enables/disables usage of prog rammable peripheral i/o area. pa15 usage of programmable peripheral i/o area 0 usage of programmable peripheral i/o area disabled 1 usage of programmable peripheral i/o area enabled 15 pa15 13 to 0 pa13 to pa00 specify an address in programmabl e peripheral i/o area (corresponding to a27 to a14, respectively). caution when setting the pa15 bit to 1, be sure to set the bpc register to 8ffbh. when clearing the pa15 bit to 0, be su re to set the bpc register to 0000h. for a list of the programmable peripheral i/o register areas, see table 19-16 register access types . 3.4.8 special registers special registers are registers that are protected from being written with illegal data due to a program hang-up. the v850es/sj2 and v850es/sj2-h have eight and seven special registers, respectively. ? power save control register (psc) ? clock control register (ckc) ? processor clock control register (pcc) ? clock monitor mode register (clm) ? reset source flag register (resf) ? low voltage detection register (lvim) note ? internal ram data status register (rams) ? on-chip debug mode register (ocdm) note v850es/sj2 only in addition, the prcdm register is provided to protect again st a write access to the spec ial registers so that the application system does not inadvertently stop due to a program loop. a write access to the special registers is made in a specific sequence, and an illegal store operation is reported to the sys register.
chapter 3 cpu function user?s manual u16603ej5v1ud 91 (1) setting data to special registers set data to the special registers in the following sequence. <1> disable dma operation. <2> prepare data to be set to the special register in a general-purpose register. <3> write the data prepared in <2> to the prcmd register. <4> write the setting data to the special re gister (by using the following instructions). ? store instruction (st/sst instruction) ? bit manipulation instruction (set1/clr1/not1 instruction) (<5> to <9> insert nop instructions (5 instructions).) note <10> enable dma operation if necessary. [example] with psc register (setting standby mode) st.b r11, psmr[r0] ; set psmr register (setting idle1, idle2, and stop modes). <1>clr1 0, dchcn[r0] ; disable dma operation. n = 0 to 3 <2>mov0x02, r10 <3>st.b r10, prcmd[r0] ; write prcmd register. <4>st.b r10, psc[r0] ; set psc register. <5>nop note ; dummy instruction <6>nop note ; dummy instruction <7>nop note ; dummy instruction <8>nop note ; dummy instruction <9>nop note ; dummy instruction <10>set1 0, dchcn[r0] ; enable dma operation. n = 0 to 3 (next instruction) there is no special sequence to read a special register. note five nop instructions or more must be inserted immediately after setting the idle1 mode, idle2 mode, or stop mode (by setting the psc.stp bit to 1). cautions 1. when a store instruction is executed to store data in the command register, interrupts are not acknowledged. this is because it is assumed that steps <3> and <4> above are performed by successive store instructions. if another instruction is placed between <3> and <4>, and if an interrupt is acknowledged by that instruction, the above sequence may not be established, causing malfunction. 2. although dummy data is written to th e prcmd register, use the same general-purpose register used to set the speci al register (<4> in example) to write data to the prcmd register (<3> in example). the same applies when a general-purpose register is used for addressing.
chapter 3 cpu function user?s manual u16603ej5v1ud 92 (2) command register (prcmd) the prcmd register is an 8-bit regist er that protects the registers that may seriously affect the application system from being written, so that the system does not inadvertently stop due to a program hang-up. the first write access to a special register is valid after data has be en written in advance to the prcmd register. in this way, the value of the special register can be rewritten only in a specific sequence, so as to protect the register from an illegal write access. the prcmd register is write-only, in 8-bit units (undefined data is read when this register is read). 7 reg7 prcmd 6 reg6 5 reg5 4 reg4 3 reg3 2 reg2 1 reg1 0 reg0 after reset: undefined w address: fffff1fch
chapter 3 cpu function user?s manual u16603ej5v1ud 93 (3) system status register (sys) status flags that indicate the ope ration status of the overall system are allocated to this register. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 protection error did not occur protection error occurred prerr 0 1 detects protection error sys 0 0 0 0 0 0 prerr after reset: 00h r/w address: fffff802h < > the prerr flag operates under the following conditions. (a) set condition (prerr flag = 1) (i) when data is written to a special register without writing anything to the prcmd register (when <4> is executed without executing <3> in 3.4.8 (1) setting data to special registers ) (ii) when data is written to an on-chip peripheral i/o register other than a special register (including execution of a bit manipulation instruction) afte r writing data to the prcmd register (if <4> in 3.4.8 (1) setting data to special registers is not the setting of a special register) remark even if an on-chip peripheral i/o register is read (except by a bit manipulation instruction) between an operation to write the prcmd register and an operation to write a special register, the prerr flag is not set, and the set dat a can be written to the special register. (b) clear condition (prerr flag = 0) (i) when 0 is written to the prerr flag (ii) when the system is reset cautions 1. if 0 is written to the prerr bit of the sys register, which is not a special register, immediately after a write access to the prcm d register, the prerr bit is cleared to 0 (the write access takes precedence). 2. if data is written to the prcmd regist er, which is not a special register, immediately after a write access to the prcmd regi ster, the prerr bit is set to 1.
chapter 3 cpu function user?s manual u16603ej5v1ud 94 3.4.9 cautions (1) registers to be set first be sure to set the following registers firs t when using the v850es/sj2 and v850es/sj2-h. ? system wait control register (vswc) ? on-chip debug mode register (ocdm) ? watchdog timer mode register 2 (wdtm2) after setting the vswc, ocdm, and wdtm2 registers, set the other registers as necessary. when using the external bus, set each pin to the alternate-function bus control pin mode by using the port- related registers after setting the above registers. (a) system wait control register (vswc) the vswc register controls wait of bus a ccess to the on-chip peripheral i/o registers. three clocks are required to access an on-chip per ipheral i/o register (without a wait cycle). the v850es/sj2 and v850es/sj2-h require wait cycles ac cording to the operating frequency. set the following value to the vswc register in accordance with the frequency used. however, if f clk is greater than 20 mhz, only the v 850es/sj2-h can be used. the vswc register can be read or written in 8-bit units (address: fffff06eh, default value: 77h). operating frequency (f clk ) set value of vswc number of waits 32 khz f clk < 16.6 mhz 00h 0 (no waits) 16.6 mhz f clk < 25 mhz 01h 1 25 mhz f clk 32 mhz 11h 2 (b) on-chip debug mode register (ocdm) for details, see chapter 31 on-chip debug function . (c) watchdog timer mode register 2 (wdtm2) the wdtm2 register sets the overflow time and the operation clock of the watchdog timer 2. the watchdog timer 2 automatically st arts in the reset mode after reset is released. write the wdtm2 register to activate this operation. for details, see chapter 11 functions of watchdog timer 2 .
chapter 3 cpu function user?s manual u16603ej5v1ud 95 (2) accessing specific on-chip peripheral i/o registers this product has two types of internal system buses. one is a cpu bus and the other is a peripheral bus t hat interfaces with low-speed peripheral hardware. the clock of the cpu bus and the cloc k of the peripheral bus are asynchronous. if an access to the cpu and an access to the peripheral hardware conflict, therefore, unexpected illegal data may be transferred. if there is a possibility of a conflict, the number of cycles for acce ssing the cpu changes when t he peripheral hardware is accessed, so that correct data is transferred. as a re sult, the cpu does not start processing of the next instruction but enters the wait status. if this wait status occurs, the number of clocks required to execute an instruction increases by the number of wait clocks shown below. this must be taken into consideration if real-time processing is required. when specific on-chip peripheral i/o r egisters are accessed, more wait stat es may be required in addition to the wait states set by the vswc register. the access conditions and how to calculate the number of wait states to be inserted (number of cpu clocks) at this time are shown below. (1/2) peripheral function register name access k tpncnt read 1 or 2 read 1 or 2 16-bit timer/event counter p (tmp) (n = 0 to 8) tpnccr0, tpnccr1 write ? 1st access: no wait ? continuous write: 3 or 4 tq0cnt read 1 or 2 read 1 or 2 16-bit timer/event counter q (tmq) tq0ccr0 to tq0ccr3 write ? 1st access: no wait ? continuous write: 3 or 4 watchdog timer 2 (wdt2) wdtm2 write (when wdt2 operating) 3 rtbl0, rtbl1 write (rtpcn.rtpoen bit = 0) 1 real-time output function (rto) rtbh0, rtbh1 write (rtpcn.rtpoen bit = 0) 1 ada0m0 read 1 or 2 ada0cr0 to ada0cr15 read 1 or 2 a/d converter ada0cr0h to ada0cr15h read 1 or 2 i 2 c00 to i 2 c02 note 1 iics0 to iics2 read 1 can controller note 2 (n = 0, 1, m = 0 to 31, a = 1 to 4) cngmabt, cngmabtd, cnmaskal, cnmaskah, cnlec, cninfo, cnerc, cnie, cnints, cnbrp, cnbtr, cnts read/write (f xx /f canmod + 1)/(2 + j) (min.) note 3 (2 f xx /f canmod + 1)/(2 + j) (max.) note 3
chapter 3 cpu function user?s manual u16603ej5v1ud 96 (2/2) peripheral function register name access k cngmctrl, cngmcs, cnctrl read/write (f xx /f can + 1)/(2 + j) (min.) note 3 (2 f xx /f can + 1)/(2 + j) (max.) note 3 write (f xx /f canmod + 1)/(2 + j) (min.) note 3 (2 f xx /f canmod + 1)/(2 + j) (max.) note 3 cnrgpt, cntgpt read (3 f xx /f canmode + 1)/(2 + j) (min.) note 3 (4 f xx /f canmode + 1)/(2 + j) (max.) note 3 cnlipt, cnlopt read (3 f xx /f canmode + 1)/(2 + j) (min.) note (4 f xx /f canmode + 1)/(2 + j) (max.) note 3 write (4 f xx /f can + 1)/(2 + j) (min.) note 3 (5 f xx /f can + 1)/(2 + j) (max.) note 3 cnmctrlm read (3 f xx /f can + 1)/(2 + j) (min.) note 3 (4 f xx /f can + 1)/(2 + j) (max.) note 3 write (8 bits) (4 f xx /f canmode + 1)/(2 + j) (min.) note 3 (5 f xx /f canmode + 1)/(2 + j) (max.) note 3 write (16 bits) (2 f xx /f canmode + 1)/(2 + j) (min.) note 3 (3 f xx /f canmode + 1)/(2 + j) (max.) note 3 can controller note 2 (n = 0, 1, m = 0 to 31, a = 1 to 4) cnmdata01m, cnmdata0m, cnmdata1m, cnmdata23m, cnmdata2m, cnmdata3m, cnmdata45m, cnmdata4m, cnmdata5m, cnmdata67m, cnmdata6m, cnmdata7m, cnmdlcm, cnmconfm, cnmidlm, cnmidhm read (8/16 bits) (3 f xx /f canmode + 1)/(2 + j) (min.) note 3 (4 f xx /f canmode + 1)/(2 + j) (max.) note 3 crc crcd write 1 number of clocks necessary for access = 3 + i + j + (2 + j) k notes 1. i 2 c bus versions (y products) only 2. can controller versions only 3. digits below the decimal point are rounded up. caution accessing the above registers is prohibited in the following statuses. if a wait cycle is generated, it can only be cleared by a reset. ? when the cpu operates with the subclock a nd the main clock oscillation is stopped ? when the cpu operates with th e internal oscillation clock remark f xx : main clock frequency = f xx f canmod : can module system clock f can : supply clock to can i: values (0 or 1) of higher 4 bits of vswc register j: values (0 or 1) of lower 4 bits of vswc register
chapter 3 cpu function user?s manual u16603ej5v1ud 97 (3) system reserved area in the flash memory version of the v850es/sj2 and v850es/sj2-h, 0000007ah to 0000007fh is a system reserved area for function expansion, and therefore it is recommended that this area not be used. however, in the case of the special version of the following products, be sure to set 00h to 0000007ah. ? pd70f3264, 70f3264y, 70f3274, 70f32 74y, 70f3284, 70f3284y: ver. 1.0 ? pd70f3266, 70f3266y, 70f3276, 70f 3276y, 70f3286, 70f3286y, 70f3288, 70f3288y: ver. 1.x (x: don?t care) ? pd70f3266hy, 70f3276hy, 70f3286hy, 70f3288hy: no applicable versions remarks 1. with products other than the above (including al l the products listed in this manual), operations are not affected even if 00h is set to 0000007ah. 2. check the product version by the number that follows ds, es, or cs on the third line of the package stamp. if the generic name is stamped (v 850es/sj2, v850es/sj2-h, etc.), the above restriction does not apply. for enquiries, contact an nec electronics sales representative. 0000007ah 0000007bh 0000007fh 00000080h 00000079h 00000070h 00000000h system reserved area (00h) system reserved area security id note (10 bytes) note for the security id, see 31.6.1 security id . caution when the data in the flash memory has been deleted, all the bits are set to 1.
chapter 3 cpu function user?s manual u16603ej5v1ud 98 (4) restriction on conflict between sld instruction and interrupt request (a) description if a conflict occurs between the decode operation of an instruction in <2> immediately before the sld instruction following an instruction in <1> and an in terrupt request before the instruction in <1> is complete, the execution result of the instru ction in <1> may not be stored in a register. instruction <1> ? ld instruction: ld.b, ld.h, ld.w, ld.bu, ld.hu ? sld instruction: sld.b, sl d.h, sld.w, sld.bu, sld.hu ? multiplication instruction: mul, mulh, mulhi, mulu instruction <2> mov reg1, reg2 satadd reg1, reg2 and reg1, reg2 add reg1, reg2 mulh reg1, reg2 not reg1, reg2 satadd imm5, reg2 tst reg1, reg2 add imm5, reg2 shr imm5, reg2 satsubr reg1, reg2 or reg1, reg2 subr reg1, reg2 cmp reg1, reg2 sar imm5, reg2 satsub reg1, reg2 xor reg1, reg2 sub reg1, reg2 cmp imm5, reg2 shl imm5, reg2 ld.w [r11], r10 if the decode operation of the mov instruction immediately before the sld instruction and an interrupt reques t conflict before execution of the ld instruction is complete, the executio n result of instruction may not be stored in a register. mov r10, r28 sld.w 0x28, r10 (b) countermeasure <1> when compiler (ca850) is used use ca850 ver. 2.61 or later because generation of the corresponding instruction sequence can be automatically suppressed. <2> for assembler when executing the sld instruction immediately afte r instruction , avoid the above operation using either of the following methods. ? insert a nop instruction immediat ely before the sld instruction. ? do not use the same register as the sld instructio n destination register in the above instruction executed immediately befor e the sld instruction. ? ? ?
user?s manual u16603ej5v1ud 99 chapter 4 port functions 4.1 features { i/o ports: 128 ? 5 v tolerant/n-ch open-drain output selectable: 60 (ports 0, 3 to 6, 8, 9) { input/output specifiable in 1-bit units 4.2 basic port configuration the v850es/sj2 and v8 50es/sj2-h feature a total of 128 i/o ports cons isting of ports 0, 1, 3 to 9, cd, cm, cs, ct, dh, and dl. the port configuration is shown below. figure 4-1. port configuration diagram p00 p06 port 0 pcd0 pcd3 port cd pcm0 pcm5 port cm pcs0 pcs7 pct0 pct7 port cs port ct p90 p915 port 9 pdh0 pdh7 port dh pdl0 pdl15 port dl p30 p39 port 3 port 1 p40 p42 port 4 p50 p55 port 5 p60 p615 p70 p715 p80 p81 port 6 p10 p11 port 7 port 8 caution ports 0, 3 to 6, 8, and 9 are 5 v tolerant. table 4-1. i/o buffer power supplies for pins power supply corresponding pins av ref0 port 7 av ref1 port 1 bv dd ports cd, cm, cs, ct, dh, dl ev dd reset, ports 0, 3 to 6, 8, 9
chapter 4 port functions user?s manual u16603ej5v1ud 100 4.3 port configuration table 4-2. port configuration item configuration control register port n mode register (pmn: n = 0, 1, 3 to 9, cd, cm, cs, ct, dh, dl) port n mode control register (pmcn: n = 0, 3 to 6, 8, 9, cm, cs, ct, dh, dl) port n function control register (pfcn: n = 0, 3 to 6, 9) port n function control expansion register (pfcen: n = 3, 5, 9) port n function register (pfn: n = 0, 3 to 6, 8, 9) ports i/o: 128 (1) port n register (pn) data is input from or output to an external device by writing or reading the pn register. the pn register consists of a port latch that holds output data, and a circ uit that reads the status of pins. each bit of the pn register corresponds to one pin of port n, and can be read or written in 1-bit units. pn7 output 0. output 1. pnm 0 1 control of output data (in output mode) pn6 pn5 pn4 pn3 pn2 pn1 pn0 0 1 2 3 7 5 6 7 pn after reset: 00h (output latch) r/w data is written to or read from the pn register as follows, regardless of the setting of the pmcn register. table 4-3. writing/reading pn register setting of pmn register writing to pn register reading from pn register output mode (pmnm = 0) data is written to the output latch note . in the port mode (pmcn = 0), the contents of the output latch are output from the pins. the value of the output latch is read. input mode (pmnm = 1) data is written to the output latch. the pin status is not affected note . the pin status is read. note the value written to the output latch is retained until a new value is written to the output latch.
chapter 4 port functions user?s manual u16603ej5v1ud 101 (2) port n mode register (pmn) the pmn register specifies the input or output mode of the corresponding port pin. each bit of this register corresponds to one pin of port n, and the input or output mode can be specified in 1-bit units. pmn7 output mode input mode pmnm 0 1 control of input/output mode pmn6 pmn5 pmn4 pmn3 pmn2 pmn1 pmn0 pmn after reset: ffh r/w (3) port n mode control register (pmcn) the pmcn register specifies the port mode or alternate function. each bit of this register corresponds to one pin of port n, and the mode of the port can be specified in 1-bit units. port mode alternate function mode pmcnm 0 1 specification of operation mode pmcn7 pmcn6 pmcn5 pmcn4 pmcn3 pmcn2 pmcn1 pmcn0 pmcn after reset: 00h r/w (4) port n function control register (pfcn) the pfcn register specifies the alternat e function of a port pin to be used if the pin has two alternate functions. each bit of this register corresponds to one pin of port n, and the alternate function of a port pin can be specified in 1-bit units. pfcn7 pfcn6 pfcn5 pfcn4 pfcn3 pfcn2 pfcn1 pfcn0 pfcn after reset: 00h r/w alternate function 1 alternate function 2 pfcnm 0 1 specification of alternate function
chapter 4 port functions user?s manual u16603ej5v1ud 102 (5) port n function control expansion register (pfcen) the pfcen register specifies the alte rnate function of a port pin to be used if the pin has three or more alternate functions. each bit of this register corresponds to one pin of port n, and the alternate function of a port pin can be specified in 1-bit units. pfcn7 pfcn6 pfcn5 pfcn4 pfcn3 pfcn2 pfcn1 pfcn0 pfcen7 pfcen6 pfcen5 pfcen4 pfcen3 pfcen2 pfcen1 pfcen0 after reset: 00h r/w pfcen pfcn alternate function 1 alternate function 2 alternate function 3 alternate function 4 pfcenm 0 0 1 1 specification of alternate function pfcnm 0 1 0 1 (6) port n function register (pfn) the pfn register specifies normal output or n-ch open-drain output. each bit of this register corresponds to one pin of por t n, and the output mode of the port pin can be specified in 1-bit units. pfn7 pfn6 pfn5 pfn4 pfn3 pfn2 pfn1 pfn0 normal output (cmos output) n-ch open-drain output pfnm note 0 1 control of normal output/n-ch open-drain output pfn after reset: 00h r/w note the pfnm bit of the pfn register is valid only when the pmnm bit of the pmn register is 0 (when the output mode is specified) in port mode (pmcnm bit = 0). when the pmnm bit is 1 (when the input mode is specified), the set value of the pfn register is invalid.
chapter 4 port functions user?s manual u16603ej5v1ud 103 (7) port setting set a port as illustrated below. figure 4-2. setting of each register and pin function pmcn register output mode input mode pmn register ?0? ?1? ?0? ?1? ?0? ?1? (a) (b) (c) (d) alternate function (when two alternate functions are available) port mode alternate function 1 alternate function 2 pfcn register alternate function (when three or more alternate functions are available) alternate function 1 alternate function 2 alternate function 3 alternate function 4 pfcn register pfcen register pfcenm 0 1 0 1 0 0 1 1 (a) (b) (c) (d) pfcnm remark set the alternate functions in the following sequence. <1> set the pfcn and pfcen registers. <2> set the pfcn register. <3> set the intrn or intfn register (to specify an external interrupt pin). if the pmcn register is set first, an unintende d function may be set while the pfcn and pfcen registers are being set.
chapter 4 port functions user?s manual u16603ej5v1ud 104 4.3.1 port 0 port 0 is a 7-bit port for which i/o settings can be controlled in 1-bit units. port 0 includes the following alternate-function pins. table 4-4. port 0 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p00 6 tip61/top61 i/o g-1 p01 7 tip60/top60 i/o g-1 p02 17 nmi input l-1 p03 18 intp0/adtrg input n-1 p04 19 intp1 input l-1 p05 20 intp2/drst note input aa-1 p06 21 intp3 input selectable as n-ch open-drain output l-1 note the drst pin is for on-chip debugging (flash memory version only). if on-chip debugging is not used, fix the p05/intp2/drs t pin to low level between when the reset signal of the reset pin is released and when the ocdm.ocdm0 bit is cleared (0). although the mask rom versions do not support the on-chip debug mode, an on-chip pull-down resistor is incorporated. handle the p05/intp2 pin the same as in flash memory versions. for details, see 4.6.3 cautions on on-chip debug pins . caution the p00 to p06 pins have h ysteresis characteristics in the input mode of the alternate function, but do not have hysteresis characteristics in the port mode. (1) port 0 register (p0) 0 outputs 0 outputs 1 p0n 0 1 output data control (in output mode) (n = 0 to 6) p0 p06 p05 p04 p03 p02 p01 p00 after reset: 00h (output latch) r/w address: fffff400h
chapter 4 port functions user?s manual u16603ej5v1ud 105 (2) port 0 mode register (pm0) 1 output mode input mode pm0n 0 1 i/o mode control (n = 0 to 6) pm0 pm06 pm05 pm04 pm03 pm02 pm01 pm00 after reset: ffh r/w address: fffff420h (3) port 0 mode control register (pmc0) 0 pmc0 pmc06 pmc05 pmc04 pmc03 pmc02 pmc01 pmc00 i/o port intp3 input pmc06 0 1 specification of p06 pin operation mode i/o port intp2 input pmc05 0 1 specification of p05 pin operation mode i/o port intp1 input pmc04 0 1 specification of p04 pin operation mode i/o port intp0 input/adtrg input pmc03 0 1 specification of p03 pin operation mode i/o port nmi input pmc02 0 1 specification of p02 pin operation mode i/o port tip60 input/top60 output pmc01 0 1 specification of p01 pin operation mode i/o port tip61 input/top61 output pmc00 0 1 specification of p00 pin operation mode after reset: 00h r/w address: fffff440h caution the p05/intp2/drst pin becomes the drst pin regardless of the value of the pmc05 bit when the ocdm.ocdm0 bit = 1.
chapter 4 port functions user?s manual u16603ej5v1ud 106 (4) port 0 function control register (pfc0) pfc0 after reset: 00h r/w address: fffff460h 0 0 0 0 pfc03 0 pfc01 pfc00 intp0 input adtrg input pfc03 0 1 specification of p03 pin alternate function tip60 input top60 output pfc01 0 1 specification of p01 pin alternate function tip61 input top61 output pfc00 0 1 specification of p00 pin alternate function (5) port 0 function register (pf0) 0 normal output (cmos output) n-ch open drain output pf0n 0 1 control of normal output or n-ch open-drain output (n = 0 to 6) pf0 pf06 pf05 pf04 pf03 pf02 pf01 pf00 after reset: 00h r/w address: fffffc60h caution to pull up an output pin at a voltage of ev dd or higher, be sure to set the corresponding pf0n bit to 1.
chapter 4 port functions user?s manual u16603ej5v1ud 107 4.3.2 port 1 port 1 is a 2-bit port for which i/o settings can be controlled in 1-bit units. port 1 includes the following alternate-function pins. table 4-5. port 1 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p10 3 ano0 output ? a-2 p11 4 ano1 output ? a-2 caution when the power is turned on, the p10 and p11 pins may mome ntarily output an undefined level. (1) port 1 register (p1) 0 outputs 0 outputs 1 p1n 0 1 output data control (in output mode) (n = 0, 1) p1 0 0 0 0 0 p11 p10 after reset: 00h (output latch) r/w address: fffff402h caution do not read/write the p1 register during d/a conversion (see 14.4.3 cautions). (2) port 1 mode register (pm1) 1 output mode input mode pm1n 0 1 i/o mode control (n = 0, 1) pm1 1 1 1 1 1 pm11 pm10 after reset: ffh r/w address: fffff422h cautions 1. when using p1n as the alternate functi on (anon pin output), set the pm1n bit to 1. 2. when using one of the p10 and p11 pins as an i/o port and the other as a d/a output pin, do so in an application where th e port i/o level does not change during d/a output.
chapter 4 port functions user?s manual u16603ej5v1ud 108 4.3.3 port 3 port 3 is a 10-bit port for which i/o settings can be controlled in 1-bit units. port 3 includes the following alternate-function pins. table 4-6. port 3 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p30 25 txda0/sob4 output g-3 p31 26 rxda0/intp7/sib4 input n-3 p32 27 ascka0/sckb4/tip00/top00 i/o u-1 p33 28 tip01/top01/ctxd1 note 1 i/o u-2 p34 29 tip10/top10/crxd1 note 1 i/o u-3 p35 30 tip11/top11 i/o u-4 p36 31 ctxd0 note 2 /ietx0 note 3 output g-3 p37 32 crxd0 note 2 /ierx0 note 3 input g-4 p38 35 txda2/sda00 note 4 i/o g-12 p39 36 rxda2/scl00 note 4 i/o selectable as n-ch open-drain output g-6 notes 1. can controller (2-channel) version only 2. can controller version only 3. iebus controller version only 4. i 2 c bus version (y products) only caution the p31 to p35 and p37 to p39 pins have hysteresis characteri stics in the input mode of the alternate-function pin, but do not have the h ysteresis characteristics in the port mode. (1) port 3 register (p3) outputs 0 outputs 1 p3n 0 1 output data control (in output mode) (n = 0 to 9) p3 (p3h) after reset: 0000h (output latch) r/w address: p3 fffff406h, p3l fffff406h, p3h fffff407h 0 0 0 0 0 0 p39 p38 p37 p36 p35 p34 p33 p32 p31 p30 8 9 10 11 12 13 14 15 (p3l) remarks 1. the p3 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he p3 register as the p3h register and the lower 8 bits as the p3l register, p3 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the p3 register in 8- bit or 1-bit units, specify them as bits 0 to 7 of the p3h register.
chapter 4 port functions user?s manual u16603ej5v1ud 109 (2) port 3 mode register (pm3) 1 output mode input mode pm3n 0 1 i/o mode control (n = 0 to 9) 1 1 1 1 1 pm39 pm38 pm37 pm36 pm35 pm34 pm33 pm32 pm31 pm30 after reset: ffffh r/w address: pm3 fffff426h, pm3l fffff426h, pm3h fffff427h 8 9 10 11 12 13 14 15 pm3 (pm3h) (pm3l) remarks 1. the pm3 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he pm3 register as the pm3h register and the lower 8 bits as the pm3l register, pm3 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pm3 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pm3h register. (3) port 3 mode control register (pmc3) (1/2) i/o port rxda2 input/scl00 i/o pmc39 0 1 specification of p39 pin operation mode i/o port txda2 output/sda00 i/o pmc38 0 1 specification of p38 pin operation mode after reset: 0000h r/w address: pmc3 fffff446h, pmc3l fffff446h, pmc3h fffff447h pmc37 pmc36 pmc35 pmc34 pmc33 pmc32 pmc31 pmc30 0 0 0 0 0 0 pmc39 pmc38 8 9 10 11 12 13 14 15 pmc3 (pmc3h) (pmc3l)
chapter 4 port functions user?s manual u16603ej5v1ud 110 (2/2) i/o port tip11 input/top11 output pmc35 0 1 specification of p35 pin operation mode i/o port tip10 input/top10 output/crxd1 input pmc34 0 1 specification of p34 pin operation mode i/o port crxd0 input/ierx0 input pmc37 0 1 specification of p37 pin operation mode i/o port ctxd0 output/ietx0 output pmc36 0 1 specification of p36 pin operation mode i/o port tip01 input/top01 output/ctxd1 output pmc33 0 1 specification of p33 pin operation mode i/o port ascka0 input/sckb4 i/o/tip00 input/top00 output pmc32 0 1 specification of p32 pin operation mode i/o port rxda0 input/sib4 input/intp7 input pmc31 0 1 specification of p31 pin operation mode i/o port txda0 output/sob4 output pmc30 0 1 specification of p30 pin operation mode remarks 1. the pmc3 register can be read or written in 16-bit units. however, when using the higher 8 bits of th e pmc3 register as the pmc3h register and the lower 8 bits as the pmc3l register, pmc3 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pmc3 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pmc3h register.
chapter 4 port functions user?s manual u16603ej5v1ud 111 (4) port 3 function control register (pfc3) after reset: 0000h r/w address: pfc3 fffff466h, pfc3l fffff466h, pfc3l fffff467h 0 0 0 0 0 0 pfc39 pfc38 pfc37 pfc36 pfc35 pfc34 pfc33 pfc32 pfc31 pfc30 8 9 10 11 12 13 14 15 pfc3 (pfc3h) (pfc3l) remarks 1. for details of alternate function specification, see 4.3.3 (6) port 3 alternate function specifications . 2. the pfc3 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he pfc3 register as the pfc3h register and the lower 8 bits as the pfc3l register, pfc3 ca n be read or written in 8-bit and 1-bit units. 3. to read/write bits 8 to 15 of the pfc3 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pfc3h register. (5) port 3 function control ex pansion register l (pfce3l) pfce3l after reset: 00h r/w address: fffff706h 0 0 0 pfce34 pfce33 pfce32 0 0 remark for details of alternate function specification, see 4.3.3 (6) port 3 alternate function specifications . (6) port 3 alternate function specifications pfc39 specification of p39 pin alternate function 0 rxda2 input 1 scl00 input pfc38 specification of p38 pin alternate function 0 txda2 output 1 sda00 i/o pfc37 specification of p37 pin alternate function 0 crxd0 input 1 ierx0 input
chapter 4 port functions user?s manual u16603ej5v1ud 112 pfc36 specification of p36 pin alternate function 0 ctxd0 output 1 ietx0 output pfc35 specification of p35 pin alternate function 0 tip11 input 1 top11 output pfce34 pfc3 specification of p34 pin alternate function 0 0 tip10 input 0 1 top10 output 1 0 crxd1 input 1 1 setting prohibited pfce33 pfc33 specification of p33 pin alternate function 0 0 tip01 input 0 1 top01 output 1 0 ctxd1 output 1 1 setting prohibited pfce32 pfc32 specification of p32 pin alternate function 0 0 ascka0 input 0 1 sckb4 i/o 1 0 tip00 input 1 1 top00 output pfc31 specification of p31 pin alternate function 0 rxda0 input/intp7 note input 1 sib4 input pfc30 specification of p30 pin alternate function 0 txda0 output 1 sob4 output note the intp7 pin and rxda0 pin are alternate-function pins. when using the pin as the rxda0 pin, disable edge detection for the intp7 alternate-function pin. (clear the intf3.intf31 bit and the intr3.intr31 bit to 0.) when using the pin as the intp7 pin, stop uarta0 reception. (clear the ua0ctl0.ua0rxe bit to 0.)
chapter 4 port functions user?s manual u16603ej5v1ud 113 (7) port 3 function register (pf3) after reset: 0000h r/w address: pf3 fffffc66h, pf3l fffffc66h, pf3h fffffc67h pf37 pf36 pf35 pf34 pf33 pf32 pf31 pf30 0 0 0 0 0 0 pf39 pf38 8 9 10 11 12 13 14 15 normal output (cmos output) n-ch open-drain output pf3n 0 1 control of normal output or n-ch open-drain output (n = 0 to 9) pf3 (pf3h) (pf3l) caution to pull up an output pin at a voltage of ev dd or higher, be sure to set the corresponding pf3n bit to 1. remarks 1. the pf3 register can be read or written in 16-bit units. however, when using the higher 8 bits of the pf 3 register as the pf3h register and the lower 8 bits as the pf3l register, pf3 can be re ad or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pf3 register in 8-bit or 1-bit uni ts, specify them as bits 0 to 7 of the pf3h register.
chapter 4 port functions user?s manual u16603ej5v1ud 114 4.3.4 port 4 port 4 is a 3-bit port that controls i/o in 1-bit units. port 4 includes the following alternate-function pins. table 4-7. port 4 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p40 22 sib0/sda01 note i/o g-6 p41 23 sob0/scl01 note i/o g-12 p42 24 sckb0 i/o selectable as n-ch open-drain output e-3 note i 2 c bus versions (y products) only caution the p40 to p42 pins have hysteresis characteri stics in the input mode of the alternate-function pin, but do not have the hysteresis characteristics in the port mode. (1) port 4 register (p4) 0 outputs 0 outputs 1 p4n 0 1 output data control (in output mode) (n = 0 to 2) p4 0 0 0 0 p42 p41 p40 after reset: 00h (output latch) r/w address: fffff408h (2) port 4 mode register (pm4) 1 output mode input mode pm4n 0 1 i/o mode control (n = 0 to 2) pm4 1 1 1 1 pm42 pm41 pm40 after reset: ffh r/w address: fffff428h
chapter 4 port functions user?s manual u16603ej5v1ud 115 (3) port 4 mode control register (pmc4) 0 pmc4 0 0 0 0 pmc42 pmc41 pmc40 i/o port sckb0 i/o pmc42 0 1 specification of p42 pin operation mode i/o port sob0 output/scl01 i/o pmc41 0 1 specification of p41 pin operation mode i/o port sib0 input/sda01 i/o pmc40 0 1 specification of p40 pin operation mode after reset: 00h r/w address: fffff448h (4) port 4 function control register (pfc4) pfc4 after reset: 00h r/w address: fffff468h 0 0 0 0 0 0 pfc41 pfc40 sob0 output scl01 i/o pfc41 0 1 specification of p41 pin alternate function sib0 input sda01 i/o pfc40 0 1 specification of p40 pin alternate function
chapter 4 port functions user?s manual u16603ej5v1ud 116 (5) port 4 function register (pf4) 0 normal output (cmos output) n-ch open-drain output pf4n 0 1 control of normal output or n-ch open-drain output (n = 0 to 2) pf4 0 0 0 0 pf42 pf41 pf40 after reset: 00h r/w address: fffffc68h caution to pull up an output pin at a voltage of ev dd or higher, be sure to set the corresponding pf4n bit to 1.
chapter 4 port functions user?s manual u16603ej5v1ud 117 4.3.5 port 5 port 5 is a 6-bit port that controls i/o in 1-bit units. port 5 includes the following alternate-function pins. table 4-8. port 5 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p50 37 tiq01/kr0/toq01/rtp00 i/o u-5 p51 38 tiq02/kr1/toq02/rtp01 i/o u-5 p52 39 tiq03/kr2/toq03/rtp02/ddi note i/o u-6 p53 40 sib2/kr3/tiq00/toq00/rtp03/ddo note i/o u-7 p54 41 sob2/kr4/rtp04/dck note i/o u-8 p55 42 sckb2/kr5/rtp05/dms note i/o selectable as n-ch open-drain output u-9 note the ddi, ddo, dck, and dms pins are for on-chip debugging (flash memory version only). if on-chip debugging is not used, fix the p05/intp2/drs t pin to low level between when the reset signal of the reset pin is released and when the ocdm.ocdm0 bit is cleared (0). although the mask rom versions do not support the on-chip debug mode, an on-chip pull-down resistor is incorporated. handle the p05/intp2 pin the same as the flash memory versions. for details, see 4.6.3 cautions on on-chip debug pins . cautions 1. when the power is turned on, the p53 pin may mome ntarily output an undefined level. 2. the p50 to p55 pins have hysteresis characteristics in th e input mode of the alternate function, but do not have hysteresis characteristics in the port mode. (1) port 5 register (p5) 0 outputs 0 outputs 1 p5n 0 1 output data control (in output mode) (n = 0 to 5) p5 0 p55 p54 p53 p52 p51 p50 after reset: 00h (output latch) r/w address: fffff40ah
chapter 4 port functions user?s manual u16603ej5v1ud 118 (2) port 5 mode register (pm5) 1 output mode input mode pm5n 0 1 i/o mode control (n = 0 to 5) pm5 1 pm55 pm54 pm53 pm52 pm51 pm50 after reset: ffh r/w address: fffff42ah (3) port 5 mode control register (pmc5) 0 pmc5 0 pmc55 pmc54 pmc53 pmc52 pmc51 pmc50 i/o port sckb2 i/o/kr5 input/rtp05 output pmc55 0 1 specification of p55 pin operation mode i/o port sob2 output/kr4 input/rtp04 output pmc54 0 1 specification of p54 pin operation mode i/o port sib2 input/kr3 input/tiq00 input/toq00 output/rtp03 output pmc53 0 1 specification of p53 pin operation mode i/o port tiq03 input/kr2 input/toq03 output/rtp02 output pmc52 0 1 specification of p52 pin operation mode i/o port tiq02 input/kr1 input/toq02 output/rtp01 output pmc51 0 1 specification of p51 pin operation mode i/o port tiq01 input/kr0 input/toq01 output/rtp00 output pmc50 0 1 specification of p50 pin operation mode after reset: 00h r/w address: fffff44ah
chapter 4 port functions user?s manual u16603ej5v1ud 119 (4) port 5 function control register (pfc5) 0 pfc5 0 pfc55 pfc54 pfc53 pfc52 pfc51 pfc50 after reset: 00h r/w address: fffff46ah remark for details of alternate function specification, see 4.3.5 (6) port 5 alternate function specifications . (5) port 5 function control expansion register (pfce5) 0 pfce5 0 pfce55 pfce54 pfce53 pfce52 pfce51 pfce50 after reset: 00h r/w address: fffff70ah remark for details of alternate function specification, see 4.3.5 (6) port 5 alternate function specifications . (6) port 5 alternate function specifications pfce55 pfc55 specification of p55 pin alternate function 0 0 sckb2 i/o 0 1 kr5 input 1 0 setting prohibited 1 1 rtp05 output pfce54 pfc54 specification of p54 pin alternate function 0 0 sob2 output 0 1 kr4 input 1 0 setting prohibited 1 1 rtp04 output pfce53 pfc53 specification of p53 pin alternate function 0 0 sib2 input 0 1 tiq00 input/kr3 note input 1 0 toq00 output 1 1 rtp03 output
chapter 4 port functions user?s manual u16603ej5v1ud 120 pfce52 pfc52 specification of p52 pin alternate function 0 0 setting prohibited 0 1 tiq03 input/kr2 note input 1 0 toq03 input 1 1 rtp02 output pfce51 pfc51 specification of p51 pin alternate function 0 0 setting prohibited 0 1 tiq02 input/kr1 note input 1 0 toq02 output 1 1 rtp01 output pfce50 pfc50 specification of p50 pin alternate function 0 0 setting prohibited 0 1 tiq01 input/kr0 note input 1 0 toq01 output 1 1 rtp00 output note the krn pin and tiq0m pin are alternate-function pins. when using the pin as the tiq0m pin, disable krn pin key return detection, which is the al ternate function. (clear the krm.krmn bit to 0.) also, when using the pin as the krn pin, disable tiq0m pin edge detection, which is the alternate function (n = 0 to 3, m = 0 to 3). pin name use as tiq0m pin use as krn pin kr0/tiq01 krm.krm0 bit = 0 tq0ioc1. tq0tig2, tq0ioc1. tq0tig3 bits = 0 kr1/tiq02 krm.krm1 bit = 0 tq0ioc1.tq0tig4, tq0ioc1.tq0tig5 bits = 0 kr2/tiq03 krm.krm2 bit = 0 tq0ioc1.tq0tig6, tq0ioc1.tq0tig7 bits = 0 kr3/tiq00 krm.krm3 bit = 0 tq0ioc1.tq0tig0, tq0ioc1.tq0tig1 bits = 0 tq0ioc2.tq0ees0, tq0ioc2.tq0ees1 bits = 0 tq0ioc2.tq0ets0, tq0ioc2.tq0ets1 bits = 0 (7) port 5 function register (pf5) 0 normal output (cmos output) n-ch open-drain output pf5n 0 1 control of normal output or n-ch open-drain output (n = 0 to 5) pf5 0 pf55 pf54 pf53 pf52 pf51 pf50 after reset: 00h r/w address: fffffc6ah caution to pull up an output pin at a voltage of ev dd or higher, be sure to set the corresponding pf5n bit to 1.
chapter 4 port functions user?s manual u16603ej5v1ud 121 4.3.6 port 6 port 6 is a 16-bit port for which i/o settings can be controlled in 1-bit units. port 6 includes the following alternate-function pins. table 4-9. port 6 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p60 43 rtp10 output e-2 p61 44 rtp11 output e-2 p62 45 rtp12 output e-2 p63 46 rtp13 output e-2 p64 47 rtp14 output e-2 p65 48 rtp15 output e-2 p66 49 sib5 input e-1 p67 50 sob5 output e-2 p68 51 sckb5 i/o e-3 p69 52 tip70/top70 i/o g-1 p610 53 tip71 input e-1 p611 54 top71 output e-2 p612 55 tip80/top80 i/o g-1 p613 56 tip81/top81 i/o g-1 p614 57 ? ? c-1 p615 58 ? ? selectable as n-ch open-drain output c-1 caution the p66, p68 to p610, p612, and p613 pins have hysteresis ch aracteristics in the input mode of the alternate-function pin, but do not have th e hysteresis characteristics in the port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 122 (1) port 6 register (p6) outputs 0 outputs 1 p6n 0 1 output data control (in output mode) (n = 0 to 15) p6 (p6h) after reset: 0000h (output latch) r/w address: p6 fffff40ch, p6l fffff40ch, p6h fffff40dh p615 p614 p613 p612 p611 p610 p69 p68 p67 p66 p65 p64 p63 p62 p61 p60 8 9 10 11 12 13 14 15 (p6l) remarks 1. the p6 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he p6 register as the p6h register and the lower 8 bits as the p6l register, p6 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the p6 register in 8- bit or 1-bit units, specify them as bits 0 to 7 of the p6h register. (2) port 6 mode register (pm6) pm615 output mode input mode pm6n 0 1 i/o mode control (n = 0 to 15) pm614 pm613 pm612 pm611 pm610 pm69 pm68 pm67 pm66 pm65 pm64 pm63 pm62 pm61 pm60 after reset: ffffh r/w address: pm6 fffff42ch, pm6l fffff42ch, pm6h fffff42dh 8 9 10 11 12 13 14 15 pm6 (pm6h) (pm6l) remarks 1. the pm6 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he pm6 register as the pm6h register and the lower 8 bits as the pm6l register, pm6 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pm6 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pm6h register.
chapter 4 port functions user?s manual u16603ej5v1ud 123 (3) port 6 mode control register (pmc6) i/o port tip81 input/top81 output pmc613 0 1 specification of p613 pin operation mode i/o port tip80 input/top80 output pmc612 0 1 specification of p612 pin operation mode after reset: 0000h r/w address: pmc6 fffff44ch, pmc6l fffff44ch, pmc6h fffff44dh pmc67 pmc66 pmc65 pmc64 pmc63 pmc62 pmc61 pmc60 0 0 pmc613 pmc612 pmc611 pmc610 pmc69 pmc68 8 9 10 11 12 13 14 15 pmc6 (pmc6h) (pmc6l) i/o port tip70 input/top70 output pmc69 0 1 specification of p69 pin operation mode i/o port sckb5 i/o pmc68 0 1 specification of p68 pin operation mode i/o port top71 output pmc611 0 1 specification of p611 pin operation mode i/o port tip71 input pmc610 0 1 specification of p610 pin operation mode i/o port sob5 output pmc67 0 1 specification of p67 pin operation mode i/o port sib5 input pmc66 0 1 specification of p66 pin operation mode i/o port rtp1m i/o pmc6m 0 1 specification of p6m pin operation mode (m = 0 to 5) remarks 1. the pmc6 register can be read or written in 16-bit units. however, when using the higher 8 bits of th e pmc6 register as the pmc6h register and the lower 8 bits as the pmc6l register, pmc6 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pmc6 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pmc6h register.
chapter 4 port functions user?s manual u16603ej5v1ud 124 (4) port 6 function control register h (pfc6h) 0 pfc6h 0 pfc613 pfc612 0 0 pfc69 0 tip81 input top81 output pfc613 0 1 specification of p613 pin operation mode tip80 input top80 output pfc612 0 1 specification of p612 pin operation mode tip70 input top70 output pfc69 0 1 specification of p69 pin operation mode after reset: 00h r/w address: fffff46dh 8 9 10 11 12 13 14 15 (5) port 6 function register (pf6) after reset: 0000h r/w address: pf6 fffffc6ch, pf6l fffffc6ch, pf6h fffffc6dh pf67 pf66 pf65 pf64 pf63 pf62 pf61 pf60 pf615 pf614 pf613 pf612 pf611 pf610 pf69 pf68 8 9 10 11 12 13 14 15 normal output (cmos output) n-ch open-drain output pf6n 0 1 control of normal output or n-ch open-drain output (n = 0 to 15) pf6 (pf6h) (pf6l) caution to pull up an output pin at a voltage of ev dd or higher, be sure to set the corresponding pf6n bit to 1. remarks 1. the pf6 register can be read or written in 16-bit units. however, when using the higher 8 bits of the pf 6 register as the pf6h register and the lower 8 bits as the pf6l register, pf6 can be re ad or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pf6 register in 8-bit or 1-bit uni ts, specify them as bits 0 to 7 of the pf6h register.
chapter 4 port functions user?s manual u16603ej5v1ud 125 4.3.7 port 7 port 7 is a 16-bit port for which i/o settings can be controlled in 1-bit units. port 7 includes the following alternate-function pins. table 4-10. port 7 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p70 144 ani0 input a-1 p71 143 ani1 input a-1 p72 142 ani2 input a-1 p73 141 ani3 input a-1 p74 140 ani4 input a-1 p77 139 ani5 input a-1 p76 138 ani6 input a-1 p77 137 ani7 input a-1 p78 136 ani8 input a-1 p79 135 ani9 input a-1 p710 134 ani10 input a-1 p711 133 ani11 input a-1 p712 132 ani12 input a-1 p713 131 ani13 input a-1 p714 130 ani14 input a-1 p715 129 ani15 input ? a-1
chapter 4 port functions user?s manual u16603ej5v1ud 126 (1) port 7 register h, port 7 register l (p7h, p7l) outputs 0 outputs 1 p7n 0 1 output data control (in output mode) (n = 0 to 15) p7h p7l after reset: 00h (output latch) r/w address: p7l fffff40eh, p7h fffff40fh p77 p76 p75 p74 p73 p72 p71 p70 p715 p714 p713 p712 p711 p710 p79 p78 caution do not read/write the p7h and p7l regist ers during a/d conversion (see 13.6 (4) alternate i/o). remark these registers cannot be accessed in 16-bit units as the p7 register. they can be read or written in 8-bit or 1-bit units as the p7h and p7l registers. (2) port 7 mode register h, port 7 mode register l (pm7h, pm7l) pm715 output mode input mode pm7n 0 1 i/o mode control (n = 0 to 15) pm7h pm7l pm714 pm713 pm712 pm711 pm710 pm79 pm78 pm77 pm76 pm75 pm74 pm73 pm72 pm71 pm70 after reset: ffh r/w address: pm7l fffff42eh, pm7h fffff42fh caution when using the p7n pin as its alternate function (anin pin), set the pm7n bit to 1. remark these registers cannot be accessed in 16-bit units as the pm7 register. they can be read or written in 8-bit or 1-bit units as the pm7h and pm7l registers.
chapter 4 port functions user?s manual u16603ej5v1ud 127 4.3.8 port 8 port 8 is a 2-bit port that controls i/o in 1-bit units. port 8 includes the following alternate-function pins. table 4-11. port 8 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p80 59 rxda3/intp8 input l-2 p81 60 txda3 output selectable as n-ch open-drain output e-2 caution the p80 pin has hysteresis char acteristics in the input mode of the alternate-function pin, but do not have the hysteresis characteristics in the port mode. (1) port 8 register (p8) 0 outputs 0 outputs 1 p8n 0 1 output data control (in output mode) (n = 0, 1) p8 0 0 0 0 0 p81 p80 after reset: 00h (output latch) r/w address: fffff410h (2) port 8 mode register (pm8) 1 output mode input mode pm8n 0 1 i/o mode control (n = 0, 1) pm8 1 1 1 1 1 pm81 pm80 after reset: ffh r/w address: fffff430h
chapter 4 port functions user?s manual u16603ej5v1ud 128 (3) port 8 mode control register (pmc8) 0 pmc4 0 0 0 0 0 pmc81 pmc80 i/o port txda3 output pmc81 0 1 specification of p81 pin operation mode i/o port rxda3 input/intp8 note input pmc80 0 1 specification of p80 pin operation mode after reset: 00h r/w address: fffff450h note the intp8 and rxda3 pins are alternate-functi on pins. when using the rxda3 pin, disable detection of the edge of the intp8 pin (intf8.intf80 bit = 0 and intr8.intr80 bit = 0). when using the intp8 pin, stop the reception oper ation of uarta3 (ua3ctl0.ua3rxe bit = 0). (4) port 8 function register (pf8) 0 normal output (cmos output) n-ch open-drain output pf8n 0 1 control of normal output or n-ch open-drain output (n = 0, 1) pf8 0 0 0 0 0 pf81 pf80 after reset: 00h r/w address: fffffc70h caution to pull up an output pin at a voltage of ev dd or higher, be sure to set the corresponding pf8n bit to 1.
chapter 4 port functions user?s manual u16603ej5v1ud 129 4.3.9 port 9 port 9 is a 16-bit port for which i/o settings can be controlled in 1-bit units. port 9 includes the following alternate-function pins. table 4-12. port 9 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p90 61 a0/kr6/txda1/sda02 note i/o u-10 p91 62 a1/kr7/rxda1/scl02 note i/o u-11 p92 63 a2/tip41/top41 i/o u-12 p93 64 a3/tip40/top40 i/o u-12 p94 65 a4/tip31/top31 i/o u-12 p95 66 a5/tip30/top30 i/o u-12 p96 67 a6/tip21/top21 i/o u-13 p97 68 a7/sib1/tip20/top20 i/o u-14 p98 69 a8/sob1 output g-3 p99 70 a9/sckb1 i/o g-5 p910 71 a10/sib3 i/o g-2 p911 72 a11/sob3 output g-3 p912 73 a12/sckb3 i/o g-5 p913 74 a13/intp4 i/o n-2 p914 75 a14/intp5/tip51/top51 i/o u-15 p915 76 a15/intp6/tip50/top50 i/o selectable as n-ch open-drain output u-15 note i 2 c bus versions (y products) only caution the p90 to p97, p99, p910, and p912 to p 915 pins have hysteresis char acteristics in the input mode of the alternate-function pin, but do not ha ve the hysteresis characteristics in the port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 130 (1) port 9 register (p9) p915 outputs 0 outputs 1 p9n 0 1 output data control (in output mode) (n = 0 to 15) p914 p913 p912 p911 p910 p99 p98 after reset: 0000h (output latch) r/w address: p9 fffff412h, p9l fffff412h, p9h fffff413h p97 p96 p95 p94 p93 p92 p91 p90 8 9 10 11 12 13 14 15 p9 (p9h) (p9l) remarks 1. the p9 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he p9 register as the p9h register and the lower 8 bits as the p9l register, p9 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the p9 register in 8- bit or 1-bit units, specify them as bits 0 to 7 of the p9h register. (2) port 9 mode register (pm9) pm97 output mode input mode pm9n 0 1 i/o mode control (n = 0 to 15) pm96 pm95 pm94 pm93 pm92 pm91 pm90 after reset: ffffh r/w address: pm9 fffff432h, pm9l fffff432h, pm9h fffff433h pm915 pm914 pm913 pm912 pm911 pm910 pm99 pm98 8 9 10 11 12 13 14 15 pm9 (pm9h) (pm9l) remarks 1. the pm9 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he pm9 register as the pm9h register and the lower 8 bits as the pm9l register, pm9 can be read or written in 8-bit and 1-bit units. 2. to read/write bits 8 to 15 of the pm9 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pm9h register.
chapter 4 port functions user?s manual u16603ej5v1ud 131 (3) port 9 mode control register (pmc9) (1/2) i/o port a15 output/intp6 input/tip50 input/top50 output pmc915 0 1 specification of p915 pin operation mode pmc97 pmc96 pmc95 pmc94 pmc93 pmc92 pmc91 pmc90 after reset: 0000h r/w address: pmc9 fffff452h, pmc9l fffff452h, pmc9h fffff453h pmc915 pmc914 pmc913 pmc912 pmc911 pmc910 pmc99 pmc98 i/o port a14 output/intp5 input/tip51 input/top51 output pmc914 0 1 specification of p914 pin operation mode i/o port a11 output/sob3 output pmc911 0 1 specification of p911 pin operation mode i/o port a10 output/sib3 input pmc910 0 1 specification of p910 pin operation mode i/o port a9 output/sckb1 i/o pmc99 0 1 specification of p99 pin operation mode i/o port a13 output/intp4 input pmc913 0 1 specification of p913 pin operation mode i/o port a12 output/sckb3 i/o pmc912 0 1 specification of p912 pin operation mode 8 9 10 11 12 13 14 15 pmc9 (pmc9h) (pmc9l) remarks 1. the pmc9 register can be read or written in 16-bit units. however, when using the higher 8 bits of th e pmc9 register as the pmc9h register and the lower 8 bits as the pmc9l register, pmc9 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pmc9 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pmc9h register.
chapter 4 port functions user?s manual u16603ej5v1ud 132 (2/2) i/o port a8 output/sob1 output pmc98 0 1 specification of p98 pin operation mode i/o port a7 output/sib1 input/tip20 input/top20 output pmc97 0 1 specification of p97 pin operation mode i/o port a6 output/tip21 input/top21 output pmc96 0 1 specification of p96 pin operation mode i/o port a5 output/tip30 input/top30 output pmc95 0 1 specification of p95 pin operation mode i/o port a4 output/tip31 input/top31 output pmc94 0 1 specification of p94 pin operation mode i/o port a3 output/tip40 input/top40 output pmc93 0 1 specification of p93 pin operation mode i/o port a2 output/tip41 input/top41 output pmc92 0 1 specification of p92 pin operation mode i/o port a1 output/kr7 input/rxda1 input/scl02 i/o pmc91 0 1 specification of p91 pin operation mode i/o port a0 output/kr6 input/txda1 output/sda02 i/o pmc90 0 1 specification of p90 pin operation mode caution port 9 pins cannot be used as port pins or other alternate-function pins if even one of the a0 to a15 pins is used in the separate bus mode. afte r setting the pfc9 and pfce9 registers to 0000h, theref ore, set all 16 bits of the pmc9 re gister to ffffh at once. if even one of the a0 to a15 pins is not used in th e separate bus mode, port 9 pins can be used as port pins or other alte rnate-function pins.
chapter 4 port functions user?s manual u16603ej5v1ud 133 (4) port 9 function control register (pfc9) caution port 9 pins cannot be used as port pins or ot her alternate-function pins if even one of the a0 to a15 pins is used in the separate bus mode . after setting the pfc9 and pfce9 registers to 0000h, therefore, set all 16 bits of th e pmc9 register to ffffh at once. if even one of the a0 to a15 pins is not used in the separate bus mode, port 9 pins can be used as port pins or other alternate-function pins. after reset: 0000h r/w address: pfc9 fffff472h, pfc9l fffff472h, pfc9h fffff473h pfc97 pfc96 pfc95 pfc94 pfc93 pfc92 pfc91 pfc90 pfc915 pfc914 pfc913 pfc912 pfc911 pfc910 pfc99 pfc98 8 9 10 11 12 13 14 15 pfc9 (pfc9h) (pfc9l) remarks 1. for details of alternate function specification, see 4.3.9 (6) port 9 alternate function specifications . 2. the pfc9 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he pfc9 register as the pfc9h register and the lower 8 bits as the pfc9l register, pfc9 ca n be read or written in 8-bit or 1-bit units. 3. to read/write bits 8 to 15 of the pfc9 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pfc9h register. (5) port 9 function control expansion register (pfce9) after reset: 0000h r/w address: pfce9 fffff712h, pfce9l fffff712h, pfce9h fffff713h pfce97 pfce96 pfce95 pfce94 pfce93 pfce92 pfce91 pfce90 pfce915 pfce914 0 0 0 0 0 0 8 9 10 11 12 13 14 15 pfce9 (pfce9h) (pfce9l) remarks 1. for details of alternate function specification, see 4.3.9 (6) port 9 alternate function specifications . 2. the pfce9 register can be read or written in 16-bit units. however, when using the higher 8 bits of the pfce9 register as the pf ce9h register and the lower 8 bits as the pfce9l register, pfce9 c an be read or written in 8-bit or 1-bit units. 3. to read/write bits 8 to 15 of the pfce9 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pfce9h register.
chapter 4 port functions user?s manual u16603ej5v1ud 134 (6) port 9 alternate function specifications pfce915 pfc915 specification of p915 pin alternate function 0 0 a15 output 0 1 intp6 input 1 0 tip50 input 1 1 top50 output pfce914 pfc914 specification of p914 pin alternate function 0 0 a14 output 0 1 intp5 input 1 0 tip51 input 1 1 top51 output pfc913 specification of p913 pin alternate function 0 a13 output 1 intp4 input pfc912 specification of p912 pin alternate function 0 a12 output 1 sckb3 i/o pfc911 specification of p911 pin alternate function 0 a11 output 1 sob3 output pfc910 specification of p910 pin alternate function 0 a10 output 1 sib3 input pfc99 specification of p99 pin alternate function 0 a9 output 1 sckb1 i/o pfc98 specification of p98 pin alternate function 0 a8 output 1 sob1 output pfce97 pfc97 specification of p97 pin alternate function 0 0 a7 output 0 1 sib1 input 1 0 tip20 input 1 1 top20 output
chapter 4 port functions user?s manual u16603ej5v1ud 135 pfce96 pfc96 specification of p96 pin alternate function 0 0 a6 output 0 1 setting prohibited 1 0 tip21 input 1 1 top21 output pfce95 pfc95 specification of p95 pin alternate function 0 0 a5 output 0 1 tip30 input 1 0 top30 output 1 1 setting prohibited pfce94 pfc94 specification of p94 pin alternate function 0 0 a4 output 0 1 tip31 input 1 0 top31 output 1 1 setting prohibited pfce93 pfc93 specification of p93 pin alternate function 0 0 a3 output 0 1 tip40 input 1 0 top40 output 1 1 setting prohibited pfce92 pfc92 specification of p92 pin alternate function 0 0 a2 output 0 1 tip41 input 1 0 top41 output 1 1 setting prohibited pfce91 pfc91 specification of p91 pin alternate function 0 0 a1 output 0 1 kr7 input 1 0 rxda1 input/kr7 input note 1 1 scl02 i/o pfce90 pfc90 specification of p90 pin alternate function 0 0 a0 output 0 1 kr6 input 1 0 txda1 output 1 1 sda02 i/o note the rxda1 and kr7 pins must not be used at the same time. when using the rxda1 pin, do not use the kr7 pin. when using the kr7 pin, do not use the rx da1 pin (it is recommended to set the pfc91 bit to 1 and clear the pfce91 bit to 0).
chapter 4 port functions user?s manual u16603ej5v1ud 136 (7) port 9 function register (pf9) after reset: 0000h r/w address: pf3 fffffc72h, pf9l fffffc72h, pf9h fffffc73h pf97 pf96 pf95 pf94 pf93 pf92 pf91 pf90 pf915 pf914 pf913 pf912 pf911 pf910 pf99 pf98 normal output (cmos output) n-ch open-drain output pf9n 0 1 control of normal output or n-ch open-drain output (n = 0 to 15) 8 9 10 11 12 13 14 15 pf9 (pf9h) (pf9l) caution to pull up an output pin at a voltage of ev dd or higher, be sure to set the corresponding pf9n bit to 1. remarks 1. the pf9 register can be read or written in 16-bit units. however, when using the higher 8 bits of the pf 9 register as the pf9h register and the lower 8 bits as the pf9l register, pf9 can be re ad or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pf9 register in 8-bit or 1-bit uni ts, specify them as bits 0 to 7 of the pf9h register.
chapter 4 port functions user?s manual u16603ej5v1ud 137 4.3.10 port cd port cd is a 4-bit port that controls i/o in 1-bit units. port cd includes the following alternate-function pins. table 4-13. port cd alternate-function pins pin name pin no. alternate-function pin name i/o remark block type pcd0 77 ? ? b-1 pcd1 78 ? ? b-1 pcd2 79 ? ? b-1 pcd3 80 ? ? ? b-1 (1) port cd register (pcd) 0 outputs 0 outputs 1 pcdn 0 1 output data control (in output mode) (n = 0 to 3) pcd 0 0 0 pcd3 pcd2 pcd1 pcd0 after reset: 00h (output latch) r/w address: fffff00eh (2) port cd mode register (pmcd) 1 output mode input mode pmcdn 0 1 i/o mode control (n = 0 to 3) pmcd 1 1 1 pmcd3 pmcd2 pmcd1 pmcd0 after reset: ffh r/w address: fffff02eh
chapter 4 port functions user?s manual u16603ej5v1ud 138 4.3.11 port cm port cm is a 6-bit port for which i/o setti ngs can be controlled in 1-bit units. port cm includes the following alternate-function pins. table 4-14. port cm alternate-function pins pin name pin no. alternate-function pin name i/o remark block type pcm0 85 wait input d-1 pcm1 86 clkout output d-2 pcm2 87 hldak output d-2 pcm3 88 hldrq input d-1 pcm4 89 ? ? b-1 pcm5 90 ? ? ? b-1 (1) port cm register (pcm) 0 outputs 0 outputs 1 pcmn 0 1 output data control (in output mode) (n = 0 to 5) pcm 0 pcm5 pcm4 pcm3 pcm2 pcm1 pcm0 after reset: 00h (output latch) r/w address: fffff00ch (2) port cm mode register (pmcm) 1 output mode input mode pmcmn 0 1 i/o mode control (n = 0 to 5) pmcm 1 pmcm5 pmcm4 pmcm3 pmcm2 pmcm1 pmcm0 after reset: ffh r/w address: fffff02ch
chapter 4 port functions user?s manual u16603ej5v1ud 139 (3) port cm mode control register (pmccm) 0 pmccm 0 0 0 pmccm3 pmccm2 pmccm1 pmccm0 i/o port hldrq input pmccm3 0 1 specification of pcm3 pin operation mode i/o port hldak output pmccm2 0 1 specification of pcm2 pin operation mode i/o port clkout output pmccm1 0 1 specification of pcm1 pin operation mode i/o port wait input pmccm0 0 1 specification of pcm0 pin operation mode after reset: 00h r/w address: fffff04ch
chapter 4 port functions user?s manual u16603ej5v1ud 140 4.3.12 port cs port cs is an 8-bit port for which i/o se ttings can be controll ed in 1-bit units. port cs includes the following alternate-function pins. table 4-15. port cs alternate-function pins pin name pin no. alternate-function pin name i/o remark block type pcs0 81 cs0 output d-2 pcs1 82 cs1 output d-2 pcs2 83 cs2 output d-2 pcs3 84 cs3 output d-2 pcs4 91 ? ? b-1 pcs5 92 ? ? b-1 pcs6 93 ? ? b-1 pcs7 94 ? ? ? b-1 (1) port cs register (pcs) pcs7 outputs 0 outputs 1 pcsn 0 1 output data control (in output mode) (n = 0 to 7) pcs pcs6 pcs5 pcs4 pcs3 pcs2 pcs1 pcs0 after reset: 00h (output latch) r/w address: fffff008h (2) port cs mode register (pmcs) output mode input mode pmcsn 0 1 i/o mode control (n = 0 to 7) pmcs pmcs5 pmcs7 pmcs6 pmcs4 pmcs3 pmcs2 pmcs1 pmcs0 after reset: ffh r/w address: fffff028h
chapter 4 port functions user?s manual u16603ej5v1ud 141 (3) port cs mode control register (pmccs) 0 pmccs 0 0 0 pmccs3 pmccs2 pmccs1 pmccs0 i/o port cs3 output pmccs3 0 1 specification of pcs3 pin operation mode i/o port cs2 output pmccs2 0 1 specification of pcs2 pin operation mode i/o port cs1 output pmccs1 0 1 specification of pcs1 pin operation mode i/o port cs0 output pmccs0 0 1 specification of pcs0 pin operation mode after reset: 00h r/w address: fffff048h
chapter 4 port functions user?s manual u16603ej5v1ud 142 4.3.13 port ct port ct is an 8-bit port for which i/o se ttings can be controll ed in 1-bit units. port ct includes the following alternate-function pins. table 4-16. port ct alternate-function pins pin name pin no. alternate-function pin name i/o remark block type pct0 95 wr0 output d-2 pct1 96 wr1 output d-2 pct2 97 ? ? b-1 pct3 98 ? ? b-1 pct4 99 rd output d-2 pct5 100 ? ? b-1 pct6 101 astb output d-2 pct7 102 ? ? ? b-1 (1) port ct register (pct) pct7 outputs 0 outputs 1 pctn 0 1 output data control (in output mode) (n = 0 to 7) pct pct6 pct5 pct4 pct3 pct2 pct1 pct0 after reset: 00h (output latch) r/w address: fffff00ah (2) port ct mode register (pmct) pmct7 output mode input mode pmctn 0 1 i/o mode control (n = 0 to 7) pmct pmct6 pmct5 pmct4 pmct3 pmct2 pmct1 pmct0 after reset: ffh r/w address: fffff02ah
chapter 4 port functions user?s manual u16603ej5v1ud 143 (3) port ct mode control register (pmcct) 0 pmcct pmcct6 0 pmcct4 0 0 pmcct1 pmcct0 i/o port astb output pmcct6 0 1 specification of pct6 pin operation mode i/o port rd output pmcct4 0 1 specification of pct4 pin operation mode i/o port wr1 output pmcct1 0 1 specification of pct1 pin operation mode i/o port wr0 output pmcct0 0 1 specification of pct0 pin operation mode after reset: 00h r/w address: fffff04ah
chapter 4 port functions user?s manual u16603ej5v1ud 144 4.3.14 port dh port dh is an 8-bit port for which i/o setti ngs can be controlled in 1-bit units. port dh includes the following alternate-function pins. table 4-17. port dh alternate-function pins pin name pin no. alternate-function pin name i/o remark block type pdh0 121 a16 output d-2 pdh1 122 a17 output d-2 pdh2 123 a18 output d-2 pdh3 124 a19 output d-2 pdh4 125 a20 output d-2 pdh5 126 a21 output d-2 pdh6 127 a22 output d-2 pdh7 128 a23 output ? d-2 (1) port dh register (pdh) outputs 0 outputs 1 pdhn 0 1 output data control (in output mode) (n = 0 to 7) pdh after reset: 00h (output latch) r/w address: fffff006h pdh7 pdh6 pdh5 pdh4 pdh3 pdh2 pdh1 pdh0 (2) port dh mode register (pmdh) pmdh7 output mode input mode pmdhn 0 1 i/o mode control (n = 0 to 7) pmdh6 pmdh5 pmdh4 pmdh3 pmdh2 pmdh1 pmdh0 after reset: ffh r/w address: fffff026h pmdh
chapter 4 port functions user?s manual u16603ej5v1ud 145 (3) port dh mode control register (pmcdh) i/o port am output (address bus output) (m = 16 to 23) pmcdhn 0 1 specification of pdhn pin operation mode (n = 0 to 7) pmcdh7 pmcdh6 pmcdh5 pmcdh4 pmcdh3 pmcdh2 pmcdh1 pmcdh0 after reset: 00h r/w address: fffff046h pmcdh
chapter 4 port functions user?s manual u16603ej5v1ud 146 4.3.15 port dl port dl is a 16-bit port for which i/o se ttings can be controll ed in 1-bit units. port dl includes the following alternate-function pins. table 4-18. port dl alternate-function pins pin name pin no. alternate-function pin name i/o remark block type pdl0 105 ad0 i/o d-3 pdl1 106 ad1 i/o d-3 pdl2 107 ad2 i/o d-3 pdl3 108 ad3 i/o d-3 pdl4 109 ad4 i/o d-3 pdl5 110 ad5/flmd1 note i/o d-3 pdl6 111 ad6 i/o d-3 pdl7 112 ad7 i/o d-3 pdl8 113 ad8 i/o d-3 pdl9 114 ad9 i/o d-3 pdl10 115 ad10 i/o d-3 pdl11 116 ad11 i/o d-3 pdl12 117 ad12 i/o d-3 pdl13 118 ad13 i/o d-3 pdl14 119 ad14 i/o d-3 pdl15 120 ad15 i/o ? d-3 note since this pin is set in the flash memory progra mming mode, it does not need to be manipulated with the port control register. for details, see chapter 30 flash memory . (1) port dl register (pdl) pdl15 outputs 0 outputs 1 pdln 0 1 output data control (in output mode) (n = 0 to 15) pdl14 pdl13 pdl12 pdl11 pdl10 pdl9 pdl8 after reset: 0000h (output latch) r/w address: pdl fffff004h, pdll fffff004h, pdlh fffff005h pdl7 pdl6 pdl5 pdl4 pdl3 pdl2 pdl1 pdl0 8 9 10 11 12 13 14 15 pdl (pdlh) (pdll) remarks 1. the pdl register can be read or written in 16-bit units. however, when using the higher 8 bits of the pd l register as the pdlh register and the lower 8 bits as the pdll register, pdl can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pdl register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pdlh register.
chapter 4 port functions user?s manual u16603ej5v1ud 147 (2) port dl mode register (pmdl) pmdl7 output mode input mode pmdln 0 1 i/o mode control (n = 0 to 15) pmdl6 pmdl5 pmdl4 pmdl3 pmdl2 pmdl1 pmdl0 after reset: ffffh r/w address: pmdl fffff024h, pmdll fffff024h, pmdlh fffff025h pmdl15 pmdl14 pmdl13 pmdl12 pmdl11 pmdl10 pmdl9 pmdl8 8 9 10 11 12 13 14 15 pmdl (pmdlh) (pmdll) remarks 1. the pmdl register can be read or written in 16-bit units. however, when using the higher 8 bits of the pmdl register as the pmdlh register and the lower 8 bits as the pmdll register, pmdl can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pmdl register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pmdlh register. (3) port dl mode control register (pmcdl) i/o port adn i/o (address/data bus i/o) pmcdln 0 1 specification of pdln pin operation mode (n = 0 to 15) pmcdl7 pmcdl6 pmcdl5 pmcdl4 pmcdl3 pmcdl2 pmcdl1 pmcdl0 after reset: 0000h r/w address: pmcdl fffff044h, pmcdll fffff044h, pmcdlh fffff045h pmcdl15 pmcdl14pmcdl13 pmcdl12 pmcdl11pmcdl10 pmcdl9 pmcdl8 8 9 10 11 12 13 14 15 pmcdl (pmcdlh) (pmcdll) caution when the smsel bit of the eximc register = 1 (separate mode) and the bs30 to bs00 bits of the bsc register = 0 (8-bit bus width) , do not specify the ad8 to ad15 pins. remarks 1. the pmcdl register can be read or written in 16-bit units. however, when using the higher 8 bits of the pmcdl register as the pmcdlh register and the lower 8 bits as the pmcdll register, pmcdl c an be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pmcdl register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pmcdlh register.
chapter 4 port functions user?s manual u16603ej5v1ud 148 4.4 block diagrams figure 4-3. block diagram of type a-1 address rd a/d input signal wr pm pmmn wr port pmn pmn p-ch n-ch internal bus selector selector
chapter 4 port functions user?s manual u16603ej5v1ud 149 figure 4-4. block diagram of type a-2 rd d/a output signal wr pm pmmn wr port pmn pmn p-ch n-ch internal bus selector selector address
chapter 4 port functions user?s manual u16603ej5v1ud 150 figure 4-5. block diagram of type b-1 internal bus address rd wr pm pmmn wr port pmn pmn selector selector figure 4-6. block diagram of type c-1 internal bus address selector selector rd wr port pmn wr pf pfmn wr pm pmmn pmn ev dd ev ss p-ch n-ch
chapter 4 port functions user?s manual u16603ej5v1ud 151 figure 4-7. block diagram of type d-1 wr port pmn wr pm pmmn wr pmc pmcmn rd input signal when alternate function is used pmn internal bus selector selector address
chapter 4 port functions user?s manual u16603ej5v1ud 152 figure 4-8. block diagram of type d-2 wr port pmn wr pm pmmn wr pmc pmcmn rd output signal when alternate function is used pmn internal bus selector selector selector address
chapter 4 port functions user?s manual u16603ej5v1ud 153 figure 4-9. block diagram of type d-3 wr port pmn wr pm pmmn wr pmc pmcmn rd pmn output signal when alternate function is used input signal when alternate function is used output enable signal of address/data bus input enable signal of address/data bus output buffer off signal internal bus selector selector selector selector address
chapter 4 port functions user?s manual u16603ej5v1ud 154 figure 4-10. block diagram of type e-1 internal bus address input signal when alternate function is used selector selector rd wr port pmn wr pmc pmcmn wr pf pfmn wr pm pmmn pmn ev dd ev ss p-ch n-ch note note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 155 figure 4-11. block diagram of type e-2 internal bus address output signal when alternate function is used selector selector rd wr port pmn wr pmc pmcmn wr pf pfmn wr pm pmmn pmn ev dd ev ss p-ch n-ch selector
chapter 4 port functions user?s manual u16603ej5v1ud 156 figure 4-12. block diagram of type e-3 rd wr port pmn wr pmc pmcmn wr pf pfmn wr pm pmmn pmn ev dd ev ss p-ch n-ch output signal when alternate function is used output enable signal when alternate function is used input signal when alternate function is used note internal bus selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 157 figure 4-13. block diagram of type g-1 input signal when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal when alternate function is used pmn ev dd ev ss p-ch n-ch note internal bus selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 158 figure 4-14. block diagram of type g-2 input signal when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal when alternate function is used pmn ev dd ev ss p-ch n-ch note internal bus selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 159 figure 4-15. block diagram of type g-3 output signal 2 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch internal bus selector selector selector selector address
chapter 4 port functions user?s manual u16603ej5v1ud 160 figure 4-16. block diagram of type g-4 rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn input signal 2 when alternate function is used input signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch note internal bus selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 161 figure 4-17. block diagram of type g-5 rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal 2 when alternate function is used output signal 1 when alternate function is used output enable signal when alternate function is used pmn ev dd ev ss p-ch n-ch input signal when alternate function is used note internal bus selector selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 162 figure 4-18. block diagram of type g-6 output signal when alternate function is used input signal 1 when alternate function is used input signal 2 when alternate function is used note internal bus selector selector selector selector address rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn pmn ev dd ev ss p-ch n-ch note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 163 figure 4-19. block diagram of type g-12 input signal when alternate function is used output signal 1 when alternate function is used output signal 2 when alternate function is used note internal bus selector address rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn pmn ev dd ev ss p-ch n-ch selector selector selector note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 164 figure 4-20. block diagram of type l-1 input signal 1 when alternate function is used rd wr port pmn wr pmc pmcmn wr intr intrmn note 1 wr intf intfmn note 1 wr pf pfmn wr pm pmmn pmn ev dd ev ss p-ch n-ch edge detection noise elimination note 2 internal bus selector selector address notes 1. see 22.6 external interrupt request i nput pins (nmi and intp0 to intp7) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 165 figure 4-21. block diagram of type l-2 internal bus address input signal 1-1 when alternate function is used selector selector rd wr port pmn wr pmc pmcmn wr intr intrmn note 1 wr intf intfmn note 1 wr pf pfmn wr pm pmmn pmn input signal 1-2 when alternate function is used ev dd ev ss p-ch n-ch edge detection noise elimination note 2 notes 1. see 22.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 166 figure 4-22. block diagram of type n-1 input signal 1 when alternate function is used rd wr port pmn wr pmc pmcmn wr intr intrmn note 1 wr intf intfmn note 1 wr pf pfmn wr pm wr pfc pfcmn pmmn pmn input signal 2 when alternate function is used ev dd ev ss p-ch n-ch edge detection noise elimination note 2 internal bus selector selector selector address notes 1. see 22.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 167 figure 4-23. block diagram of type n-2 internal bus address input signal when alternate function is used selector selector selector rd wr port pmn wr pmc pmcmn wr intr intrmn note 1 wr intf intfmn note 1 wr pf pfmn wr pm wr pfc pfcmn pmmn pmn ev dd ev ss p-ch n-ch edge detection noise elimination note 2 output signal when alternate function is used notes 1. see 22.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 168 figure 4-24. block diagram of type n-3 input signal 1-1 when alternate function is used input signal 1-2 when alternate function is used input signal 2 when alternate function is used rd wr port pmn wr pmc pmcmn wr intr intrmn note 1 wr intf intfmn note 1 wr pf pfmn wr pm wr pfc pfcmn pmmn pmn ev dd ev ss p-ch n-ch note 2 internal bus selector selector selector address edge detection noise elimination notes 1. see 22.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 169 figure 4-25. block diagram of type u-1 input signal 2 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn input signal 1 when alternate function is used input signal 3 when alternate function is used output signal 2 when alternate function is used output signal 1 when alternate function is used output enable signal when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 170 figure 4-26. block diagram of type u-2 internal bus address input signal when alternate function is used selector selector selector rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal 2 when alternate function is used output signal 3 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn selector note note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 171 figure 4-27. block diagram of type u-3 internal bus address input signal 2 when alternate function is used selector selector selector rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn input signal 1 when alternate function is used input signal 3 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn selector note note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 172 figure 4-28. block diagram of type u-4 internal bus address input signal when alternate function is used selector selector selector rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal 2 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn selector note note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 173 figure 4-29. block diagram of type u-5 input signal 1-1 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn input signal 1-2 when alternate function is used output signal 2 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector address noise elimination note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 174 figure 4-30. block diagram of type u-6 input signal 1-1 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr ocdm0 ocdm0 wr pmc pmcmn wr pm pmmn input signal 1-2 when alternate function is used input signal when on-chip debugging pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector address output signal 2 when alternate function is used output signal 1 when alternate function is used noise elimination note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 175 figure 4-31. block diagram of type u-7 input signal 1 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr ocdm0 ocdm0 wr pmc pmcmn wr pm pmmn input signal 2-1 when alternate function is used input signal 2-2 when alternate function is used output signal when on-chip debugging pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector selector selector address output signal 2 when alternate function is used output signal 1 when alternate function is used noise elimination note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 176 figure 4-32. block diagram of type u-8 input signal when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr ocdm0 ocdm0 wr pmc pmcmn wr pm pmmn input signal when on-chip debugging pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector address output signal 2 when alternate function is used output signal 1 when alternate function is used noise elimination note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 177 figure 4-33. block diagram of type u-9 input signal 1 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr ocdm0 ocdm0 wr pmc pmcmn wr pm pmmn input signal 2 when alternate function is used input signal when on-chip debugging output enable signal when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector selector address output signal 2 when alternate function is used output signal 1 when alternate function is used noise elimination note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 178 figure 4-34. block diagram of type u-10 internal bus address input signal 1 when alternate function is used selector selector selector selector rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn input signal 2 when alternate function is used output signal 2 when alternate function is used output signal 3 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn noise elimination note selector note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 179 figure 4-35. block diagram of type u-11 internal bus address input signal 1 when alternate function is used selector selector selector selector rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn input signal 3 when alternate function is used output signal 2 when alternate function is used output signal 1 when alternate function is used pmn input signal 2 when alternate function is used ev dd ev ss p-ch n-ch wr pfce pfcemn noise elimination note selector note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 180 figure 4-36. block diagram of type u-12 input signal when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal 2 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 181 figure 4-37. block diagram of type u-13 input signal when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal 2 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 182 figure 4-38. block diagram of type u-14 input signal 1 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn input signal 2 when alternate function is used output signal 2 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector address selector note hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 183 figure 4-39. block diagram of type u-15 input signal 1 when alternate function is used input signal 2 when alternate function is used rd wr port pmn wr pmc pmcmn wr intr intrmn note 1 wr intf intfmn note 1 wr pf pfmn wr pm wr pfc pfcmn wr pfce pfcemn pmmn pmn ev dd ev ss p-ch n-ch output signal 2 when alternate function is used output signal 1 when alternate function is used note 2 internal bus selector selector selector selector address edge detection noise elimination selector notes 1. see 22.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 184 figure 4-40. block diagram of type aa-1 rd wr port pmn wr intf intfmn note 1 wr pf pfmn wr ocdm0 ocdm0 wr pmc pmcmn wr pm pmmn pmn ev dd ev ss p-ch n-ch n-ch wr intr intrmn note 1 ev ss input signal when on-chip debugging external reset signal input signal when alternate function is used note 2 internal bus selector selector address edge detection noise elimination notes 1. see 22.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions user?s manual u16603ej5v1ud 185 4.5 port register settings when alternate function is used table 4-19 shows the port register settings when each port is used for an alternate function. when using a port pin as an alternate-function pin, refer to the description of each pin.
chapter 4 port functions 186 user?s manual u16603ej5v1ud table 4-19. using port pin as alternate-function pin (1/9) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) tip61 input p00 = setting not required pm00 = setting not required pmc00 = 1 ? pfc00 = 0 p00 top61 output p00 = setting not required pm00 = setting not required pmc00 = 1 ? pfc00 = 1 tip60 input p01 = setting not required pm01 = setting not required pmc01 = 1 ? pfc01 = 0 p01 top60 output p01 = setting not required pm01 = setting not required pmc01 = 1 ? pfc01 = 1 p02 nmi input p02 = setting not required pm02 = setting not required pmc02 = 1 ? ? intp0 input p03 = setting not required pm03 = setting not required pmc03 = 1 ? pfc03 = 0 p03 adtrg input p03 = setting not required pm03 = setting not required pmc03 = 1 ? pfc03 = 1 p04 intp1 input p04 = setting not required pm04 = setting not required pmc04 = 1 ? ? intp2 input p05 = setting not required pm05 = setting not required pmc05 = 1 ? ? p05 drst note 1 input p05 = setting not required pm05 = setting not required pmc05 = setting not required ? ? ocdm0 (ocdm) = 1 p06 intp3 input p06 = setting not required pm06 = setting not required pmc06 = 1 ? ? p10 ano0 output p10 = setting not required pm10 = 1 ? ? ? p11 ano1 output p11 = setting not required pm11 = 1 ? ? ? txda0 output p30 = setting not required pm30 = setting not required pmc30 = 1 ? pfc30 = 0 p30 sob4 output p30 = setting not required pm30 = setting not required pmc30 = 1 ? pfc30 = 1 rxda0 input p31 = setting not required pm31 = setting not required pmc31 = 1 ? note 2 , pfc31 = 0 intp7 input p31 = setting not required pm31 = setting not required pmc31 = 1 ? note 2 , pfc31 = 0 p31 sib4 input p31 = setting not required pm31 = setting not required pmc31 = 1 ? pfc31 = 1 ascka0 input p32 = setting not required pm32 = setting not required pmc32 = 1 pfce32 = 0 pfc32 = 0 sckb4 i/o p32 = setting not required pm32 = setting not required pmc32 = 1 pfce32 = 0 pfc32 = 1 tip00 input p32 = setting not required pm32 = setting not required pmc32 = 1 pfce32 = 1 pfc32 = 0 p32 top00 output p32 = setting not required pm32 = setting not required pmc32 = 1 pfce32 = 1 pfc32 = 1 notes 1. flash memory versions only 2. the intp7 pin and rxda0 pin are alternate-function pins. when using the pin as the rxda0 pin, disable edge detection for the alternate-function intp7 pin (clear the intf3.intf31 bit and intr3.intr31 bit to 0). when using the pin as the intp7 pin, stop the uarta0 reception ope ration (clear the ua0ctl0.ua0rxe bit to 0). caution when using one of the p10 and p11 pi ns as an i/o port and the other as a d/a out put pin (ano0, ano1), do so in an appli cation where the port i/o level does not change during d/a output.
chapter 4 port functions user?s manual u16603ej5v1ud 187 table 4-19. using port pin as alternate-function pin (2/9) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) tip01 input p33 = setting not required pm33 = setting not required pmc33 = 1 pfce33 = 0 pfc33 = 0 top01 output p33 = setting not required pm33 = setting not required pmc33 = 1 pfce33 = 0 pfc33 = 1 p33 ctxd1 note 1 output p33 = setting not required pm33 = setting not required pmc33 = 1 pfce33 = 1 pfc33 = 0 tip10 input p34 = setting not required pm34 = setting not required pmc34 = 1 pfce34 = 0 pfc34 = 0 top10 input p34 = setting not required pm34 = setting not required pmc34 = 1 pfce34 = 0 pfc34 = 1 p34 crxd1 note 1 input p34 = setting not required pm34 = setting not required pmc34 = 1 pfce34 = 1 pfc34 = 0 tip11 input p35 = setting not required pm35 = setting not required pmc35 = 1 ? pfc35 = 0 p35 top11 output p35 = setting not required pm35 = setting not required pmc35 = 1 ? pfc35 = 1 ctxd0 note 2 output p36 = setting not required pm36 = setting not required pmc36 = 1 ? pfc36 = 0 p36 ietx0 note 3 output p36 = setting not required pm36 = setting not required pmc36 = 1 ? pfc36 = 1 crxd0 note 2 input p37 = setting not required pm37 = setting not required pmc37 = 1 ? pfc37 = 0 p37 ierx0 note 3 input p37 = setting not required pm37 = setting not required pmc37 = 1 ? pfc37 = 1 txda2 output p38 = setting not required pm38 = setting not required pmc38 = 1 ? pfc38 = 0 p38 sda00 note 4 i/o p38 = setting not required pm38 = setting not required pmc38 = 1 ? pfc38 = 1 pf38 (pf3) = 1 rxda2 input p39 = setting not required pm39 = setting not required pmc39 = 1 ? pfc39 = 0 p39 scl00 note 4 i/o p39 = setting not required pm39 = setting not required pmc39 = 1 ? pfc39 = 1 pf39 (pf3) = 1 sib0 input p40 = setting not required pm40 = setting not required pmc40 = 1 ? pfc40 = 0 p40 sda01 note 4 i/o p40 = setting not required pm40 = setting not required pmc40 = 1 ? pfc40 = 1 pf40 (pf4) = 1 sob0 output p41 = setting not required pm41 = setting not required pmc41 = 1 ? pfc41 = 0 p41 scl01 note 4 i/o p41 = setting not required pm41 = setting not required pmc41 = 1 ? pfc41 = 1 pf41 (pf4) = 1 p42 sckb0 i/o p42 = setting not required pm42 = setting not required pmc42 = 1 ? ? notes 1. can controller (2-channel) versions only 2. can controller versions only 3. iebus controller versions only 4. i 2 c bus versions (y products) only
chapter 4 port functions 188 user?s manual u16603ej5v1ud table 4-19. using port pin as alternate-function pin (3/9) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) tiq01 input p50 = setting not required pm50 = setting not required pmc50 = 1 pfce50 = 0 pfc50 = 1 krm0 (krm) = 0 kr0 input p50 = setting not required pm50 = setting not required pmc50 = 1 pfce50 = 0 pfc50 = 1 tq0tig2, tq0tig3 (tq0ioc1) = 0 toq01 output p50 = setting not required pm50 = setting not required pmc50 = 1 pfce50 = 1 pfc50 = 0 p50 rtp00 output p50 = setting not required pm50 = setting not required pmc50 = 1 pfce50 = 1 pfc50 = 1 tiq02 input p51 = setting not required pm51 = setting not required pmc51 = 1 pfce51 = 0 pfc51 = 1 krm1 (krm) = 0 kr1 input p51 = setting not required pm51 = setting not required pmc51 = 1 pfce51 = 0 pfc51 = 1 tq0tig4, tq0tig5 (tq0ioc1) = 0 toq02 output p51 = setting not required pm51 = setting not required pmc51 = 1 pfce51 = 1 pfc51 = 0 p51 rtp01 output p51 = setting not required pm51 = setting not required pmc51 = 1 pfce51 = 1 pfc51 = 1 tiq03 input p52 = setting not required pm52 = setting not required pmc52 = 1 pfce52 = 0 pfc52 = 1 krm2 (krm) = 0 kr2 input p52 = setting not required pm52 = setting not required pmc52 = 1 pfce52 = 0 pfc52 = 1 tq0tig6, tq0tig7 (tq0i0c1) = 0 toq03 output p52 = setting not required pm52 = setting not required pmc52 = 1 pfce52 = 1 pfc52 = 0 rtp02 output p52 = setting not required pm52 = setting not required pmc52 = 1 pfce52 = 1 pfc52 = 1 p52 ddi note input p52 = setting not required pm52 = setting not required pmc52 = setting not required pfce52 = setting not required pfc52 = setting not required ocdm0 (ocdm) = 1 sib2 input p53 = setting not required pm53 = setting not required pmc53 = 1 pfce53 = 0 pfc53 = 0 tiq00 input p53 = setting not required pm53 = setting not required pmc53 = 1 pfce53 = 0 pfc53 = 1 krm3 (krm) = 0 kr3 input p53 = setting not required pm53 = setting not required pmc53 = 1 pfce53 = 0 pfc53 = 1 tq 0tig0, tq0tig1 (tq0ioc1) = 0, tq0ees0, tq0ees1 (tq0ioc2) = 0, tq0ets0, tq0ets1 (tq0ioc2) = 0 toq00 input p53 = setting not required pm53 = setting not required pmc53 = 1 pfce53 = 1 pfc53 = 0 rtp03 output p53 = setting not required pm53 = setting not required pmc53 = 1 pfce53 = 1 pfc53 = 1 p53 ddo note output p53 = setting not required pm53 = setting not required pmc53 = setting not required pfce53 = setting not required pfc53 = setting not required ocdm0 (ocdm) = 1 note flash memory versions only
chapter 4 port functions user?s manual u16603ej5v1ud 189 table 4-19. using port pin as alternate function-pin (4/9) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) sob2 output p54 = setting not required pm54 = setting not required pmc54 = 1 pfce54 = 0 pfc54 = 0 kr4 input p54 = setting not required pm54 = setting not required pmc54 = 1 pfce54 = 0 pfc54 = 1 rtp04 output p54 = setting not required pm54 = setting not required pmc54 = 1 pfce54 = 1 pfc54 = 1 p54 dck note input p54 = setting not required pm54 = setting not required pmc54 = setting not required pfce54 = setting not required pfc54 = setting not required ocdm0 (ocdm) = 1 sckb2 i/o p55 = setting not required pm55 = setting not required pmc55 = 1 pfce55 = 0 pfc55 = 0 kr5 input p55 = setting not required pm55 = setting not required pmc55 = 1 pfce55 = 0 pfc55 = 1 rtp05 output p55 = setting not required pm55 = setting not required pmc55 = 1 pfce55 = 1 pfc55 = 1 p55 dms note input p55 = setting not required pm55 = setting not required pmc55 = setting not required pfce55 = setting not required pfc55 = setting not required ocdm0 (ocdm) = 1 p60 rtp10 output p60 = setting not required pm60 = setting not required pmc60 = 1 ? ? p61 rtp11 output p61 = setting not required pm61 = setting not required pmc61 = 1 ? ? p62 rtp12 output p62 = setting not required pm62 = setting not required pmc62 = 1 ? ? p63 rtp13 output p63 = setting not required pm63 = setting not required pmc63 = 1 ? ? p64 rtp14 output p64 = setting not required pm64 = setting not required pmc64 = 1 ? ? p65 rtp15 output p65 = setting not required pm65 = setting not required pmc65 = 1 ? ? p66 sib5 input p66 = setting not required pm66 = setting not required pmc66 = 1 ? ? p67 sob5 output p67 = setting not required pm67 = setting not required pmc67 = 1 ? ? p68 sckb5 i/o p68 = setting not required pm68 = setting not required pmc68 = 1 ? ? tip70 input p69 = setting not required pm69 = setting not required pmc69 = 1 ? pfc69 = 0 p69 top70 output p69 = setting not required pm69 = setting not required pmc69 = 1 ? pfc69 = 1 p610 tip71 input p610 = setting not required pm610 = setting not required pmc610 = 1 ? ? p611 top71 output p611 = setting not required pm611 = setting not required pmc611 = 1 ? ? tip80 input p612 = setting not required pm612 = setting not required pmc612 = 1 ? pfc612 = 0 p612 top80 output p612 = setting not required pm612 = setting not required pmc612 = 1 ? pfc612 = 1 tip81 input p613 = setting not required pm613 = setting not required pmc613 = 1 ? pfc613 = 0 p613 top81 output p613 = setting not required pm613 = setting not required pmc613 = 1 ? pfc613 = 1 note flash memory versions only
chapter 4 port functions 190 user?s manual u16603ej5v1ud table 4-19. using port pin as alternate function-pin (5/9) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) p70 ani0 input p70 = setting not required pm70 = 1 ? ? ? p71 ani1 input p71 = setting not required pm71 = 1 ? ? ? p72 ani2 input p72 = setting not required pm72 = 1 ? ? ? p73 ani3 input p73 = setting not required pm73 = 1 ? ? ? p74 ani4 input p74 = setting not required pm74 = 1 ? ? ? p75 ani5 input p75 = setting not required pm75 = 1 ? ? ? p76 ani6 input p76 = setting not required pm76 = 1 ? ? ? p77 ani7 input p77 = setting not required pm77 = 1 ? ? ? p78 ani8 input p78 = setting not required pm78 = 1 ? ? ? p79 ani9 input p79 = setting not required pm79 = 1 ? ? ? p710 ani10 input p710 = setting not required pm710 = 1 ? ? ? p711 ani11 input p711 = setting not required pm711 = 1 ? ? ? p712 ani12 input p712 = setting not required pm712 = 1 ? ? ? p713 ani13 input p713 = setting not required pm713 = 1 ? ? ? p714 ani14 input p714 = setting not required pm714 = 1 ? ? ? p715 ani15 input p715 = setting not required pm715 = 1 ? ? ? rxda3 input p80 = setting not required pm80 = setting not required pmc80 = 1 ? ? note p80 intp8 input p80 = setting not required pm80 = setting not required pmc80 = 1 ? ? note p81 txda3 output p81 = setting not required pm81 = setting not required pmc81 = 1 ? ? note the intp8 pin and rxda3 pin are alternate-function pins. when using the pin as the rxda3 pin, disable edge detection for the alternate-function intp8 pin (clear the intf8.intf80 bit and the intr8.intr80 bit to 0). when using the pin as the intp8 pin, stop uarta3 reception operati on (clear the ua0ctl3.ua3rxe bit to 0).
chapter 4 port functions user?s manual u16603ej5v1ud 191 table 4-19. using port pin as alternate-function pin (6/9) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) a0 output p90 = setting not required pm90 = setting not required pmc90 = 1 pfce90 = 0 pfc90 = 0 note 1 kr6 input p90 = setting not required pm90 = setting not required pmc90 = 1 pfce90 = 0 pfc90 = 1 txda1 output p90 = setting not required pm90 = setting not required pmc90 = 1 pfce90 = 1 pfc90 = 0 p90 sda02 note 2 i/o p90 = setting not required pm90 = setting not required pmc90 = 1 pfce90 = 1 pfc90 = 1 pf90 (pf9) = 1 a1 output p91 = setting not required pm91 = setting not required pmc91 = 1 pfce91 = 0 pfc91 = 0 note 1 kr7 input p91 = setting not required pm91 = setting not required pmc91 = 1 pfce91 = 0 pfc91 = 1 rxda1/kr7 note 3 input p91 = setting not required pm91 = setting not required pmc91 = 1 pfce91 = 1 pfc91 = 0 p91 scl02 note 2 i/o p91 = setting not required pm91 = setting not required pmc91 = 1 pfce91 = 1 pfc91 = 1 pf91 (pf9) = 1 a2 output p92 = setting not required pm92 = setting not required pmc92 = 1 pfce92 = 0 pfc92 = 0 note 1 tip41 input p92 = setting not required pm92 = setting not required pmc92 = 1 pfce92 = 0 pfc92 = 1 p92 top41 output p92 = setting not required pm92 = setting not required pmc92 = 1 pfce92 = 1 pfc92 = 0 a3 output p93 = setting not required pm93 = setting not required pmc93 = 1 pfce93 = 0 pfc93 = 0 note 1 tip40 input p93 = setting not required pm93 = setting not required pmc93 = 1 pfce93 = 0 pfc93 = 1 p93 top40 output p93 = setting not required pm93 = setting not required pmc93 = 1 pfce93 = 1 pfc93 = 0 a4 output p94 = setting not required pm94 = setting not required pmc94 = 1 pfce94 = 0 pfc94 = 0 note 1 tip31 input p94 = setting not required pm94 = setting not required pmc94 = 1 pfce94 = 0 pfc94 = 1 p94 top31 output p94 = setting not required pm94 = setting not required pmc94 = 1 pfce94 = 1 pfc94 = 0 a5 output p95 = setting not required pm95 = setting not required pmc95 = 1 pfce95 = 0 pfc95 = 0 note 1 tip30 input p95 = setting not required pm95 = setting not required pmc95 = 1 pfce95 = 0 pfc95 = 1 p95 top30 output p95 = setting not required pm95 = setting not required pmc95 = 1 pfce95 = 1 pfc95 = 0 notes 1. port 9 pins cannot be used as port pins or other alternate-func tion pins if even one of the a0 to a15 pins is used in the sepa rate bus mode. after setting the pfc9 and pfce9 registers to 0000h, therefore, set all 16 bits of the pmc9 register to ffffh at once. 2. i 2 c bus versions (y products) only 3. the rxda1 and kr7 pins must not be used at the same time. when using the rxda1 pin, do not use the kr7 pin. when using the kr 7 pin, do not use the rxda1 pin (it is recommended to set the pf c91 bit to 1 and clear the pfce91 bit to 0).
chapter 4 port functions 192 user?s manual u16603ej5v1ud table 4-19. using port pin as alternate-function pin (7/9) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) a6 output p96 = setting not required pm96 = setting not required pmc96 = 1 pfce96 = 0 pfc96 = 0 note tip21 input p96 = setting not required pm96 = setting not required pmc96 = 1 pfce96 = 1 pfc96 = 0 p96 top21 output p96 = setting not required pm96 = setting not required pmc96 = 1 pfce96 = 1 pfc96 = 1 a7 output p97 = setting not required pm97 = setting not required pmc97 = 1 pfce97 = 0 pfc97 = 0 note sib1 input p97 = setting not required pm97 = setting not required pmc97 = 1 pfce97 = 0 pfc97 = 1 tip20 input p97 = setting not required pm97 = setting not required pmc97 = 1 pfce97 = 1 pfc97 = 0 p97 top20 output p97 = setting not required pm97 = setting not required pmc97 = 1 pfce97 = 1 pfc97 = 1 a8 output p98 = setting not required pm98 = setting not required pmc98 = 1 ? pfc98 = 0 note p98 sob1 output p98 = setting not required pm98 = setting not required pmc98 = 1 ? pfc98 = 1 a9 output p99 = setting not required pm99 = setting not required pmc99 = 1 ? pfc99 = 0 note p99 sckb1 i/o p99 = setting not required pm99 = setting not required pmc99 = 1 ? pfc99 = 1 a10 output p910 = setting not required pm910 = setting not required pmc910 = 1 ? pfc910 = 0 note p910 sib3 input p910 = setting not required pm910 = setting not required pmc910 = 1 ? pfc910 = 1 a11 output p911 = setting not required pm911 = setting not required pmc911 = 1 ? pfc911 = 0 note p911 sob3 output p911 = setting not required pm911 = setting not required pmc911 = 1 ? pfc911 = 1 a12 output p912 = setting not required pm912 = setting not required pmc912 = 1 ? pfc912 = 0 note p912 sckb3 i/o p912 = setting not required pm912 = setting not required pmc912 = 1 ? pfc912 = 1 a13 output p913 = setting not required pm913 = setting not required pmc913 = 1 ? pfc913 = 0 note p913 intp4 input p913 = setting not required pm913 = setting not required pmc913 = 1 ? pfc913 = 1 note port 9 pins cannot be used as port pins or other alternate-function pins if even one of the a0 to a15 pins is used in the sepa rate bus mode. after setting the pfc9 and pfce9 registers to 0000h, therefore, set all 16 bits of the pmc9 register to ffffh at once.
chapter 4 port functions user?s manual u16603ej5v1ud 193 table 4-19. using port pin as alternate-function pin (8/9) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) a14 output p914 = setting not required pm914 = setting not required pmc914 = 1 pfce914 = 0 pfc914 = 0 note intp5 input p914 = setting not required pm914 = setting not required pmc914 = 1 pfce914 = 0 pfc914 = 1 tip51 input p914 = setting not required pm914 = setting not required pmc914 = 1 pfce914 = 1 pfc914 = 0 p914 top51 output p914 = setting not required pm914 = setting not required pmc914 = 1 pfce914 = 1 pfc914 = 1 a15 output p915 = setting not required pm915 = setting not required pmc915 = 1 pfce915 = 0 pfc915 = 0 note intp6 input p915 = setting not required pm915 = setting not required pmc915 = 1 pfce915 = 0 pfc915 = 1 tip50 input p915 = setting not required pm915 = setting not required pmc915 = 1 pfce915 = 1 pfc915 = 0 p915 top50 output p915 = setting not required pm915 = setting not required pmc915 = 1 pfce915 = 1 pfc915 = 1 pcs0 cs0 output pcs0 = setting not required pmcs0 = setting not required pmccs0 = 1 ? ? pcs1 cs1 output pcs1 = setting not required pmcs1 = setting not required pmccs1 = 1 ? ? pcs2 cs2 output pcs2 = setting not required pmcs2 = setting not required pmccs2 = 1 ? ? pcs3 cs3 output pcs3 = setting not required pmcs3 = setting not required pmccs3 = 1 ? ? pcm0 wait input pcm0 = setting not required pmcm0 = setting not required pmccm0 = 1 ? ? pcm1 clkout output pcm1 = setting not required pmcm1 = setting not required pmccm1 = 1 ? ? pcm2 hldak output pcm2 = setting not required pmcm2 = setting not required pmccm2 = 1 ? ? pcm3 hldrq input pcm3 = setting not required pmcm3 = setting not required pmccm3 = 1 ? ? pct0 wr0 output pct0 = setting not required pmct0 = setting not required pmcct0 = 1 ? ? pct1 wr1 output pct1 = setting not required pmct1 = setting not required pmcct1 = 1 ? ? pct4 rd output pct4 = setting not required pmct4 = setting not required pmcct4 = 1 ? ? pct6 astb output pct6 = setting not required pmct6 = setting not required pmcct6 = 1 ? ? note port 9 pins cannot be used as port pins or other alternate-function pins if even one of the a0 to a15 pins is used in the sepa rate bus mode. after setting the pfc9 and pfce9 registers to 0000h, therefore, set all 16 bits of the pmc9 register to ffffh at once.
chapter 4 port functions 194 user?s manual u16603ej5v1ud table 4-19. using port pin as alternate-function pin (9/9) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) pdh0 a16 output pdh0 = setting not required pmdh0 = setting not required pmcdh0 = 1 ? ? pdh1 a17 output pdh1 = setting not required pmdh1 = setting not required pmcdh1 = 1 ? ? pdh2 a18 output pdh2 = setting not required pmdh2 = setting not required pmcdh2 = 1 ? ? pdh3 a19 output pdh3 = setting not required pmdh3 = setting not required pmcdh3 = 1 ? ? pdh4 a20 output pdh4 = setting not required pmdh4 = setting not required pmcdh4 = 1 ? ? pdh5 a21 output pdh5 = setting not required pmdh5 = setting not required pmcdh5 = 1 ? ? pdh6 a22 output pdh6 = setting not required pmdh6 = setting not required pmcdh6 = 1 ? ? pdh7 a23 output pdh7 = setting not required pmdh7 = setting not required pmcdh7 = 1 ? ? pdl0 ad0 i/o pdl0 = setting not required pmdl0 = setting not required pmcdl0 = 1 ? ? pdl1 ad1 i/o pdl1 = setting not required pmdl1 = setting not required pmcdl1 = 1 ? ? pdl2 ad2 i/o pdl2 = setting not required pmdl2 = setting not required pmcdl2 = 1 ? ? pdl3 ad3 i/o pdl3 = setting not required pmdl3 = setting not required pmcdl3 = 1 ? ? pdl4 ad4 i/o pdl4 = setting not required pmdl4 = setting not required pmcdl4 = 1 ? ? ad5 i/o pdl5 = setting not required pmdl5 = setting not required pmcdl5 = 1 ? ? pdl5 flmd1 note input pdl5 = setting not required pmdl5 = setting not required pmcdl5 = setting not required ? ? pdl6 ad6 i/o pdl6 = setting not required pmdl6 = setting not required pmcdl6 = 1 ? ? pdl7 ad7 i/o pdl7 = setting not required pmdl7 = setting not required pmcdl7 = 1 ? ? pdl8 ad8 i/o pdl8 = setting not required pmdl8 = setting not required pmcdl8 = 1 ? ? pdl9 ad9 i/o pdl9 = setting not required pmdl9 = setting not required pmcdl9 = 1 ? ? pdl10 ad10 i/o pdl10 = setting not required pmdl10 = setting not required pmcdl10 = 1 ? ? pdl11 ad11 i/o pdl11 = setting not required pmdl11 = setting not required pmcdl11 = 1 ? ? pdl12 ad12 i/o pdl12 = setting not required pmdl12 = setting not required pmcdl12 = 1 ? ? pdl13 ad13 i/o pdl13 = setting not required pmdl13 = setting not required pmcdl13 = 1 ? ? pdl14 ad14 i/o pdl14 = setting not required pmdl14 = setting not required pmcdl14 = 1 ? ? pdl15 ad15 i/o pdl15 = setting not required pmdl15 = setting not required pmcdl15 = 1 ? ? note since this pin is set in the flash memory programming mode , it does not need to be manipulate d using the port control register . for details, see chapter 30 flash memory .
chapter 4 port functions user?s manual u16603ej5v1ud 195 4.6 cautions 4.6.1 cautions on setting port pins (1) in the v850es/sj2 and v850es/sj2-h, the general-pur pose port function and several peripheral function i/o pin share a pin. to switch between the general-purpo se port (port mode) and the peripheral function i/o pin (alternate-function mode), set by the pmcn register. in regards to this register setting sequence, note with caution the following. (a) cautions on switching from por t mode to alternate-function mode to switch from the port mode to alternat e-function mode in the following order. <1> set the pfn register note : n-ch open-drain setting <2> set the pfcn and pfcen regist ers: alternate-function selection <3> set the corresponding bit of the pmcn regist er to 1: switch to alternate-function mode if the pmcn register is set first, not e with caution that, at that moment or depending on the change of the pin states in accordance with the setting of the pf n, pfcn, and pfcen register s, unexpected operations may occur. a concrete example is shown as example below. note n-ch open-drain output pin only caution regardless of the port mo de/alternate-function mode, the pn register is read and written as follows. ? pn register read: read the port output latc h value (when pmn.pmnm bit = 0), or read the pin states (pmn.pmnm bit = 1). ? pn register write: write to the port output latch [example] scl01 pin setting example the scl01 pin is used alternately with the p41/ sob0 pin. select the valid pin functions with the pmc4, pfc4, and pf4 registers. pmc41 bit pfc41 bit pf41 bit valid pin functions 0 don?t care 1 p41 (in output port mode, n-ch open-drain output) 0 1 sob0 output (n-ch open-drain output) 1 1 1 scl01 i/o (n-ch open-drain output)
chapter 4 port functions user?s manual u16603ej5v1ud 196 the order of setting in which malfunction may occur on switching from the p41 pin to the scl01 pin are shown below. setting order setting contents pin states pin level <1> initial value (pmc41 bit = 0, pfc41 bit = 0, pf41 bit = 0) port mode (input) hi-z <2> pmc41 bit 1 sob0 output low level (high level depending on the csib0 setting) <3> pfc41 bit 1 scl01 i/o high level (cmos output) <4> pf41 bit 1 scl01 i/o hi-z (n-ch open-drain output) in <2>, i 2 c communication may be affected since the alternate-function sob0 output is output to the pin. in the cmos output period of <2 > or <3>, unnecessary current may be generated. (b) cautions on alternat e-function mode (input) the input signal to the alternate-function block is low level when the pmcn.pmcnm bit is 0 due to the and output of the pmcn register set value and the pin le vel. thus, depending on the port setting and alternate- function operation enable timing, unexpected operations may occur. therefore, switch between the port mode and alternate-function m ode in the following sequence. ? to switch from port mode to alternate-function mode (input) set the pins to the alternate-function mode usi ng the pmcn register and then enable the alternate- function operation. ? to switch from alternate-function mode (input) to port mode stop the alternate-function operation and then switch the pins to the port mode. the concrete examples are show n as example 1 and example 2. [example 1] switch from general-purpose port (p02) to external interrupt pin (nmi) when the p02/nmi pin is pulled up as shown in figure 4-41 and the rising edge is specified in the nmi pin edge detection setting, even though hi gh level is input continuously to the nmi pin during switching from the p02 pin to the an nmi pin (pmc02 bit = 0 1), this is detected as a rising edge as if the low level changed to high level, and an nmi interrupt occurs. to avoid it, set the nmi pin?s valid edge after switching from the p02 pin to the nmi pin.
chapter 4 port functions user?s manual u16603ej5v1ud 197 figure 4-41. example of switching from p02 to nmi (incorrect) pmc0 nmi interrupt occurrence 76543 2 p02/nmi 3 v 10 0 1 pmc0m bit = 0: port mode pmc0m bit = 1: alternate-function mode rising edge detector pmc02 bit = 0: low level pmc02 bit = 1: high level remark m = 0 to 7 [example 2] switch from external pin (nmi) to general-purpose port (p02) when the p02/nmi pin is pulled up as shown in figure 4-42 and the falling edge is specified in the nmi pin edge detection setting, even though hi gh level is input continuously to the nmi pin at switching from the nmi pin to the p02 pin (pmc02 bit = 1 0), this is detected as falling edge as if high level changed to low level, and nmi interrupt occurs. to avoid this, set the nmi pin edge detection as ?no edge detected? before switching to the p02 pin. figure 4-42. example of switching from nmi to p02 (incorrect) pmc0 76543 2 p02/nmi 3 v 10 nmi interrupt occurrence 1 0 pmc0m bit = 0: port mode pmc0m bit = 1: alternate-function mode falling edge detector pmc02 bit = 1: high level pmc02 bit = 0: low level remark m = 0 to 7 (2) in port mode, the pfn.pfnm bit is valid only in t he output mode (pmn.pmnm bit = 0). in the input mode (pmnm bit = 1), the value of the pfnm bit is not reflected in the buffer.
chapter 4 port functions user?s manual u16603ej5v1ud 198 4.6.2 cautions on bit manipulation instruction for port n register (pn) when a 1-bit manipulation instruction is executed on a port that provides both input and output functions, the value of the output latch of an input port that is not subject to manipulation may be written in addition to the targeted bit. therefore, it is recommended to rewr ite the output latch when switching a port from input mode to output mode. when p90 pin is an output port, p91 to p97 pins are input ports (all pin statuses are high level), and the value of the port latch is 00h, if the output of p90 pi n is changed from low level to high level via a bit manipulation instruction, t he value of the port latch is ffh. explanation: the targets of writ ing to and reading from the pn regi ster of a port whose pmnm bit is 1 are the output latch and pin status, respectively. a bit manipulation instruction is executed in the following order in the v850es/sj2 and v850es/sj2-h. <1> the pn register is read in 8-bit units. <2> the targeted one bit is manipulated. <3> the pn register is written in 8-bit units. in step <1>, the value of the out put latch (0) of p90 pin, which is an output port, is read, while the pin statuses of p91 to p97 pins, which are input ports, are read. if the pin statuses of p91 to p97 pins are high level at this time, the read value is feh. the value is changed to ffh by the manipulation in <2>. ffh is written to the output la tch by the manipulation in <3>. figure 4-43. bit manipula tion instruction (p90 pin) low-level output bit manipulation instruction (set1 0, p9l[r0]) is executed for p90 bit. pin status: high level p90 p91 to p97 port 9l latch 00000000 high-level output pin status: high level p90 p91 to p97 port 9l latch 11111111 bit manipulation instruction for p90 bit <1> p9l register is read in 8-bit units. ? in the case of p90, an output port, the value of the port latch (0) is read. ? in the case of p91 to p97, input ports, the pin status (1) is read. <2> set (1) p90 bit. <3> write the results of <2> to the output latch of p9l register in 8-bit units.
chapter 4 port functions user?s manual u16603ej5v1ud 199 4.6.3 cautions on on-chip debug pins the drst, dck, dms, ddi, and ddo pins are on-chip debug pins (these pins are available only in the flash- memory versions). after reset by the reset pin, the p05/intp2/drst pin is in itialized to function as an on-chip debug pin (drst). if a high level is input to the drst pin at this time, the on-chip debug mode is set, and the dck, dms, ddi, and ddo pins can be used. the following action must be taken if on-chip debugging is not used. ? clear the ocdm0 bit of the ocdm register (special register) (0) at this time, fix the p05/intp2/drst pin to low level from when reset by the reset pin is released until the above action is taken. if a high level is input to the drst pin before the above ac tion is taken, it may cause a malfunction (cpu deadlock). handle the p05 pin with the utmost care. caution the p05/intp2/drst pin is not initialized to function as an on-chip debug pin (drst) when a reset signal (wdt2res) is generated due to a watc hdog timer overflow, a reset signal (lvires) is generated by the low-voltage detector (lvi), or a reset signal (clmres) is generated by the clock monitor (clm) (reset by the low-voltage detector (lvi) is available only in the v850es/sj2). the ocdm register holds the current value. 4.6.4 cautions on p05/intp2/drst pin the p05/intp2/drst pin has an internal pull-down resistor (30 k typ.). after a reset by the reset pin, a pull- down resistor is connected. the pull-down resistor is disconnected when the ocdm0 bit is cleared (0). 4.6.5 cautions on p10, p11, and p53 pins when power is turned on when the power is turned on, the following pins may momentarily output an undefined level. ? p10/ano0 pin ? p11/ano1 pin ? p53/sib2/kr3/tiq00/toq00/rtp03/ddo note pin note the ddo pin is provided only in the flash memory version. 4.6.6 hysteresis characteristics in port mode, the following port pins do not have hysteresis characteristics. p00 to p06 p31 to p35, p37 to p39 p40 to p42 p50 to p55 p66, p68 to p610, p612, p613 p80 p90 to p97, p99, p910, p912 to p915 4.6.7 cautions on separate bus mode port 9 pins cannot be used as port pins or other alternate-function pins if even one of the a0 to a15 pins is used in the separate bus mode. after setting the pfc9 and pfce9 registers to 0000h, ther efore, set all 16 bits of the pmc9 register to ffffh at once. if even one of the a0 to a15 pins is not used in the s eparate bus mode, port 9 pins can be used as port pins or other alternate-function pins.
user?s manual u16603ej5v1ud 200 chapter 5 bus control function the v850es/sj2 and v850es/sj2-h are provided with an external bus interface function by which external memories such as rom and ra m, and i/o can be connected. 5.1 features output is selectable from a multiplexed bus with a mi nimum of 3 bus cycles and a separate bus with a minimum of 2 bus cycles. 8-bit/16-bit data bus selectable wait function ? programmable wait function of up to 7 states ? external wait function using wait pin idle state function bus hold function up to 16 mb of physical memory connectable the bus can be controlled at a voltage that is different fr om the operating voltage when bv dd ev dd = v dd . however, in separate bus mode, set bv dd = ev dd = v dd .
chapter 5 bus control function user?s manual u16603ej5v1ud 201 5.2 bus control pins the pins used to connect an external device are listed in the table below. table 5-1. bus control pins (multiplexed bus) bus control pin alternate-function pin i/o function ad0 to ad15 pdl0 to pdl15 i/o address/data bus a16 to a23 pdh0 to pdh7 output address bus wait pcm0 input external wait control clkout pcm1 output internal system clock wr0, wr1 pct0, pct1 output write strobe signal rd pct4 output read strobe signal astb pct6 output address strobe signal hldrq pcm3 input hldak pcm2 output bus hold control cs0 to cs3 pcs0 to pcs3 output chip select table 5-2. external control pins (separate bus) bus control pin alternate-function pin i/o function ad0 to ad15 pdl0 to pdl15 i/o data bus a0 to a15 p90 to p915 output address bus a16 to a23 pdh0 to pdh7 output address bus wait pcm0 input external wait control clkout pcm1 output internal system clock wr0, wr1 pct0, pct1 output write strobe signal rd pct4 output read strobe signal hldrq pcm3 input hldak pcm2 output bus hold control cs0 to cs3 pcs0 to pcs3 output chip select 5.2.1 pin status when internal rom, intern al ram, or on-chip peripheral i/o is accessed when the internal rom, internal ram, or on-chip peripheral i/o are accessed, the status of each pin is as follows. table 5-3. pin statuses when in ternal rom, internal ram, or on-chip peripheral i/o is accessed separate bus mode multiplexed bus mode address bus (a23 to a0) undefined a ddress bus (a23 to a16) undefined data bus (ad15 to ad0) hi-z address/data bus (ad15 to ad0) undefined control signal (rd, wr0, wr1, cs0 to cs3) high level control signal (rd, wr0, wr1, cs0 to cs3, astb) high level caution when a write access is perfo rmed to the internal rom area, address, data, and control signals are activated in the same way as acce ss to the external memory area. 5.2.2 pin status in each operation mode for the pin status of the v850es/sj2 and v850es/sj2-h in each operation mode, see 2.2 pin status .
chapter 5 bus control function user?s manual u16603ej5v1ud 202 5.3 memory block function the 16 mb external memory space is divided into memory blocks of (lower) 2 mb, 2 mb, 4 mb, and 8 mb. the programmable wait function and bus cycl e operation mode for each of these bloc ks can be independen tly controlled in one-block units. figure 5-1. data memory map: physical address (80 kb) use prohibited external memory area (8 mb) internal rom area note 4 (1 mb) external memory area (1 mb) internal ram area (60 kb) on-chip peripheral i/o area (4 kb) external memory area (4 mb) external memory area (2 mb) external memory area (2 mb) 03ffffffh 03fec000h 03febfffh 01000000h 00ffffffh 00800000h 007fffffh 00400000h 003fffffh 00200000h 001fffffh 00000000h 03ffffffh 03fff000h 03ffefffh 001fffffh 00100000h 000fffffh 00000000h use prohibited note 1 03ff0000h 03feffffh programmable peripheral i/o area note 2 or use prohibited note 3 03fef000h 03feefffh 03fec000h cs3 cs2 cs1 cs0 notes 1. use of addresses 03fef000h to 03feffffh is prohibited because these addresses are in the same area as the on-chip peripheral i/o area. 2. only the programmable peripheral i/o area is s een as images of 256 mb each in the 4 gb address space. 3. addresses 03fec000h to 03fecbffh are alloca ted to addresses 03fec000h to 03feefffh of the can controller version as a programmable per ipheral i/o area. use of these addresses in a version without a can controller is prohibited. 4. this area is an external memory area in the case of a data write access.
chapter 5 bus control function user?s manual u16603ej5v1ud 203 5.4 external bus interface mode control function the v850es/sj2 and v850es/sj2-h have the following two external bus interface modes. ? multiplexed bus mode ? separate bus mode these two modes can be selected by using the eximc register. (1) external bus interface mode control register (eximc) the eximc register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 multiplexed bus mode separate bus mode smsel 0 1 mode selection eximc 0 0 0 0 0 0 smsel after reset: 00h r/w address: ffffffbeh caution set the eximc register fr om the internal rom or internal ram area before making an external access. after setting the eximc register, be sure to insert a nop instruction.
chapter 5 bus control function user?s manual u16603ej5v1ud 204 5.5 bus access 5.5.1 number of clocks for access the following table shows the number of basic clocks required for accessing each resource. (1) in v850es/sj2 area (bus width) bus cycle type internal rom (32 bits) internal ram (32 bits) external memory (16 bits) instruction fetch (normal access) 1 1 note 1 3 + n note 2 instruction fetch (branch) 2 2 note 1 3 + n note 2 operand data access 3 1 3 + n note 2 notes 1. increases by 1 if a conflict with a data access occurs. 2. 2 + n clocks (n: number of wait states ) when the separate bus mode is selected. remark unit: clocks/access (2) in v850es/sj2-h area (bus width) bus cycle type internal rom (32 bits) internal ram (32 bits) external memory (16 bits) instruction fetch (normal access) 1 1 note 1 3 + n note 2 instruction fetch (branch) 3 2 note 1 3 + n note 2 operand data access 4 1 3 + n note 2 notes 1. increases by 1 if a conflict with a data access occurs. 2. 2 + n clocks (n: number of wait states ) when the separate bus mode is selected. remark unit: clocks/access
chapter 5 bus control function user?s manual u16603ej5v1ud 205 5.5.2 bus size setting function each external memory area selected by csn can be set by using the bsc register. however, the bus size can be set to 8 bits and 16 bits only. the external memory areas of the v850es/sj2 and v8 50es/sj2-h are selected in memory cs0 to cs3. (1) bus size configuration register (bsc) the bsc register can be read or written in 16-bit units. reset sets this register to 5555h. caution write to the bsc register after reset, an d then do not change the set values. also, do not access an external memory area until the initial settings of the bsc register are complete. after reset: 5555h r/w address: fffff066h 0 0 bsn0 0 1 8 bits 16 bits bsc 1 bs30 0 0 1 bs20 0 0 1 bs10 0 0 1 bs00 8 9 10 11 12 13 data bus width of cs n space (n = 0 to 3) 14 15 1 2 3 4 5 6 7 0 cs0 cs3 cs2 cs1 caution be sure to set bits 14, 12, 10, and 8 to ?1?, and clear bits 15, 13, 11, 9, 7, 5, 3, and 1 to ?0?.
chapter 5 bus control function user?s manual u16603ej5v1ud 206 5.5.3 access by bus size the v850es/sj2 and v850es/sj2-h access the on-chip peripheral i/o and extern al memory in 8-bi t, 16-bit, or 32- bit units. the bus size is as follows. ? the bus size of the on-chip peripheral i/o is fixed to 16 bits. ? the bus size of the external memory is selectable from 8 bits or 16 bits (by using the bsc register). the operation when each of the above is accessed is descr ibed below. all data is accessed starting from the lower side. the v850es/sj2 and v850es/sj2-h support only the little-endian format. figure 5-2. little-endian address in word 000bh 000ah 0009h 0008h 0007h 0006h 0005h 0004h 0003h 0002h 0001h 0000h 31 24 23 16 15 8 7 0 (1) data space the v850es/sj2 and v850es/sj2-h have an address misalign function. with this function, data can be placed at all addresse s, regardless of the format of the data (word data or halfword data). however, if the word data or halfword data is not aligned at the boundary, a bus cycle is generated at least twice, causing the bus efficiency to drop. (a) halfword-length data access a byte-length bus cycle is generated twice if t he least significant bit of the address is 1. (b) word-length data access (i) a byte-length bus cycle, halfword-length bus cycle, and byte-length bus cycle are generated in that order if the least significant bit of the address is 1. (ii) a halfword-length bus cycle is generated twic e if the lower 2 bits of the address are 10.
chapter 5 bus control function user?s manual u16603ej5v1ud 207 (2) byte access (8 bits) (a) 16-bit data bus width <1> access to even address (2n) <2> access to odd address (2n + 1) 7 0 7 0 byte data 15 8 external data bus 2n address 7 0 7 0 15 8 2n + 1 address byte data external data bus (b) 8-bit data bus width <1> access to even address (2n) <2> access to odd address (2n + 1) 7 0 7 0 2n address byte data external data bus 7 0 7 0 2n + 1 address byte data external data bus
chapter 5 bus control function user?s manual u16603ej5v1ud 208 (3) halfword access (16 bits) (a) with 16-bit data bus width <1> access to even address (2n) <2> access to odd address (2n + 1) 7 0 7 0 15 8 2n address 15 8 2n + 1 halfword data external data bus first access second access 7 0 7 0 15 8 15 8 7 0 7 0 15 8 15 8 2n + 2 halfword data external data bus 2n address halfword data external data bus address 2n + 1 (b) 8-bit data bus width <1> access to even address (2n) <2> access to odd address (2n + 1) first access second access 7 0 7 0 15 8 address 7 0 7 0 15 8 2n + 1 address 2n halfword data external data bus halfword data external data bus first access second access 7 0 7 0 15 8 7 0 7 0 15 8 2n + 2 2n + 1 address address halfword data external data bus halfword data external data bus
chapter 5 bus control function user?s manual u16603ej5v1ud 209 (4) word access (32 bits) (a) 16-bit data bus width (1/2) <1> access to address (4n) first access second access 7 0 7 0 15 8 4n 15 8 4n + 1 23 16 31 24 7 0 7 0 15 8 4n + 2 15 8 4n + 3 23 16 31 24 word data external data bus address word data external data bus address <2> access to address (4n + 1) first access second access third access 7 0 7 0 15 8 15 8 4n + 1 23 16 31 24 7 0 7 0 15 8 4n + 2 15 8 4n + 3 23 16 31 24 7 0 7 0 15 8 4n + 4 15 8 23 16 31 24 word data external data bus address word data external data bus address word data external data bus address
chapter 5 bus control function user?s manual u16603ej5v1ud 210 (a) 16-bit data bus width (2/2) <3> access to address (4n + 2) first access second access 7 0 7 0 15 8 4n + 2 15 8 4n + 3 23 16 31 24 7 0 7 0 15 8 4n + 4 15 8 4n + 5 23 16 31 24 word data external data bus address word data external data bus address <4> access to address (4n + 3) first access second access third access 7 0 7 0 15 8 15 8 4n + 3 23 16 31 24 7 0 7 0 15 8 4n + 4 15 8 4n + 5 23 16 31 24 7 0 7 0 15 8 4n + 6 15 8 23 16 31 24 word data external data bus address word data external data bus address word data external data bus address
chapter 5 bus control function user?s manual u16603ej5v1ud 211 (b) 8-bit data bus width (1/2) <1> access to address (4n) first access second access third access fourth access 7 0 7 0 15 8 4n 23 16 31 24 7 0 7 0 4n + 1 15 8 23 16 31 24 7 0 7 0 4n + 2 15 8 23 16 31 24 7 0 7 0 4n + 3 15 8 23 16 31 24 word data external data bus address word data external data bus address word data external data bus address word data external data bus address <2> access to address (4n + 1) first access second access third access fourth access 7 0 7 0 15 8 4n + 1 23 16 31 24 7 0 7 0 4n + 2 15 8 23 16 31 24 7 0 7 0 4n + 3 15 8 23 16 31 24 7 0 7 0 4n + 4 15 8 23 16 31 24 word data external data bus address word data external data bus address word data external data bus address word data external data bus address
chapter 5 bus control function user?s manual u16603ej5v1ud 212 (b) 8-bit data bus width (2/2) <3> access to address (4n + 2) first access second access third access fourth access word data external data bus address word data external data bus address word data external data bus address word data external data bus address 7 0 7 0 15 8 4n + 2 23 16 31 24 7 0 7 0 4n + 3 15 8 23 16 31 24 7 0 7 0 4n + 4 15 8 23 16 31 24 7 0 7 0 4n + 5 15 8 23 16 31 24 <4> access to address (4n + 3) first access second access third access fourth access 7 0 7 0 15 8 4n + 3 23 16 31 24 7 0 7 0 4n + 4 15 8 23 16 31 24 7 0 7 0 4n + 5 15 8 23 16 31 24 7 0 7 0 4n + 6 15 8 23 16 31 24 word data external data bus address word data external data bus address word data external data bus address word data external data bus address
chapter 5 bus control function user?s manual u16603ej5v1ud 213 5.6 wait function 5.6.1 programmable wait function (1) data wait control register 0 (dwc0) to realize interfacing with a low-speed memory or i/o, up to seven data wait states can be inserted in the bus cycle that is executed for each cs space. the number of wait states can be pr ogrammed by using the dwc0 register . immediately after system reset, 7 data wait states are inserted for all the blocks. the dwc0 register can be read or written in 16-bit units. reset sets this register to 7777h. cautions 1. the internal rom and internal ram areas are not subject to programmable wait, and are always accessed without a wait state. the on-ch ip peripheral i/o area is also not subject to programmable wait, and only wait control from each peripheral function is performed. 2. write to the dwc0 register after reset, a nd then do not change the set values. also, do not access an external memory area until the in itial settings of the dwc0 register are complete. 3. when the v850es/sj2-h is used in separate bus mode and operated at f xx > 20 mhz, be sure to insert one or more wait. after reset: 7777h r/w address: fffff484h 0 0 dwc0 dw32 dw12 dw31 dw11 dw30 dw10 0 0 dw22 dw02 dw21 dw01 dw20 dw00 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 0 cs0 cs3 cs2 cs1 dwn2 0 0 0 0 1 1 1 1 dwn1 0 0 1 1 0 0 1 1 dwn0 0 1 0 1 0 1 0 1 none 1 2 3 4 5 6 7 none f xx 20 mhz f xx > 20 mhz setting prohibited multiplexed bus separate bus number of wait states inserted in csn space (n = 0 to 3) caution be sure to clear bits 15, 11, 7, and 3 to ?0?.
chapter 5 bus control function user?s manual u16603ej5v1ud 214 5.6.2 external wait function to synchronize an extremely slow external memory, i/o, or asynchronous system, any number of wait states can be inserted in the bus cycle by using the external wait pin (wait). when the pcm0 pin is set to alternate function, the external wait function is enabled. access to each area of the internal rom, internal ram, a nd on-chip peripheral i/o is not subject to control by the external wait function, in the same man ner as the programmable wait function. the wait signal can be input asynchronously to clkout, and is sampled at the falling edge of the clock in the t2 and tw states of the bus cycle in the multiplexed bus mode. in the separate bus mode, it is sampled at the rising edge of the clock immediately after the t1 and tw states of the bus cycle. if the setup/hold time of the sampling timing is not satisfied, a wait state is inserted in the next state, or not inserted at all.
chapter 5 bus control function user?s manual u16603ej5v1ud 215 5.6.3 relationship between programm able wait and external wait wait cycles are inserted as the result of an or operation between the wait cycles specifi ed by the set value of the programmable wait and the wait cycles controlled by the wait pin. wait control programmable wait wait via wait pin for example, if the timing of the programmable wait an d the wait pin signal is as illustrated below, three wait states will be inserted in the bus cycle. figure 5-3. inserting wait example (a) multiplexed bus clkout t1 t2 tw tw tw t3 wait pin wait via wait pin programmable wait wait control (b) separate bus t1 tw tw tw t2 clkout wait pin wait via wait pin programmable wait wait control remark the circles indicate the sampling timing.
chapter 5 bus control function user?s manual u16603ej5v1ud 216 5.6.4 programmable address wait function address-setup or address-hold waits to be inserted in each bus cycle can be set by using the awc register. address wait insertion is set for each chip select area (cs0 to cs3). if an address setup wait is inserted, it seems that the high-clock period of the t1 state is extended by 1 clock. if an address hold wait is inserted, it seems that the low-cl ock period of the t1 state is extended by 1 clock. (1) address wait control register (awc) the awc register can be read or written in 16-bit units. reset sets this register to ffffh. cautions 1. address setup wait and address hold wa it cycles are not inserted when the internal rom area, internal ram area, and on-ch ip peripheral i/o areas are accessed. 2. write to the awc register after reset, a nd then do not change the set values. also, do not access an external memory area until the initial settings of the awc register are complete. 3. when the v850es/sj2-h is operated at f xx > 20 mhz, be sure to insert the address-hold wait and the address-setup wait. after reset: ffffh r/w address: fffff488h 1 ahw3 awc 1 asw3 1 ahw2 1 asw2 1 ahw1 1 asw1 1 ahw0 1 asw0 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 0 cs0 cs3 cs2 cs1 aswn 0 1 not inserted inserted setting prohibited inserted specifies insertion of address setup wait (n = 0 to 3) f xx 20 mhz f xx > 20 mhz ahwn 0 1 not inserted inserted setting prohibited inserted specifies insertion of address hold wait (n = 0 to 3) f xx 20 mhz f xx > 20 mhz caution be sure to set bits 15 to 8 to ?1?.
chapter 5 bus control function user?s manual u16603ej5v1ud 217 5.7 idle state insertion function to facilitate interfacing with low-speed memories, one idle state (ti) can be inserted a fter the t3 state in the bus cycle that is executed for each space se lected by the chip select in the multiplex address/data bus mode. in the separate bus mode, one idle state (ti) can be inserted after the t2 state. by inserting an idle state, the data output float delay time of the memory can be secured during read access (an idle state cannot be inserted during write access). whether the idle state is to be inserted c an be programmed by using the bcc register. an idle state is inserted for all t he areas immediately after system reset. (1) bus cycle control register (bcc) the bcc register can be read or written in 16-bit units. reset sets this register to aaaah. cautions 1. the internal rom, internal ram, a nd on-chip peripheral i/o areas are not subject to idle state insertion. 2. write to the bcc register after reset, and then do not change the set values. also, do not access an external memory area until the initial settings of the bcc register are complete. after reset: aaaah r/w address: fffff48ah 1 bc31 bcn1 0 1 not inserted i nserted bcc 0 0 1 bc21 0 0 1 bc11 0 0 1 bc01 0 0 8 9 10 11 12 13 specifies insertion of idle state (n = 0 to 3) 14 15 1 2 3 4 5 6 7 0 cs0 cs3 cs2 cs1 caution be sure to set bits 15, 13, 11, and 9 to ?1?, and clear bits 14, 12, 10, 8, 6, 4, 2, and 0 to ?0?.
chapter 5 bus control function user?s manual u16603ej5v1ud 218 5.8 bus hold function 5.8.1 functional outline the hldrq and hldak functions are valid if the pc m2 and pcm3 pins are set to alternate function. when the hldrq pin is asserted (low level), indicating th at another bus master has requested bus mastership, the external address/data bus goes into a high-impedance state and is released (bus hold status). if the request for the bus mastership is cleared and the hldrq pin is deasserted (high level), driving these pins is started again. during the bus hold period, execution of the program in the internal rom and internal ram is continued until an on-chip peripheral i/o register or t he external memory is accessed. the bus hold status is indicated by assertion of the hldak pin (low level). the bus hold function enables the configuration of mult i-processor type systems in which two or more bus masters exist. note that the bus hold request is not acknowledged during a multiple-acce ss cycle initiated by the bus sizing function or a bit manipulation instruction. status data bus width access type timing at which bus hold request is not acknowledged word access to even address between first and second access between first and second access word access to odd address between second and third access 16 bits halfword access to odd address between first and second access between first and second access between second and third access word access between third and fourth access cpu bus lock 8 bits halfword access between first and second access read-modify-write access of bit manipulation instruction ? ? between read access and write access
chapter 5 bus control function user?s manual u16603ej5v1ud 219 5.8.2 bus hold procedure the bus hold status transition procedure is shown below. <1> hldrq = 0 acknowledged <2> all bus cycle start requests inhibited <3> end of current bus cycle <4> shift to bus idle status <5> hldak = 0 <6> hldrq = 1 acknowledged <7> hldak = 1 <8> bus cycle start request inhibition released <9> bus cycle starts normal status bus hold status normal status hldak (output) hldrq (input) <1> <2> <5> <3><4> <7><8><9> <6> 5.8.3 operation in power save mode because the internal system clock is stopped in the stop , idle1, and idle2 modes, the bus hold status is not entered even if the hldrq pin is asserted. in the halt mode, the hldak pin is asserted as soon as the hldrq pin has been asserted, and the bus hold status is entered. when the hldrq pin is later deassert ed, the hldak pin is also deasserted, and the bus hold status is cleared.
chapter 5 bus control function user?s manual u16603ej5v1ud 220 5.9 bus priority bus hold, dma transfer, operand data accesses, instructio n fetch (branch), and instruction fetch (successive) are executed in the external bus cycle. bus hold has the highest priority, followed by dma trans fer, operand data access, instruction fetch (branch), and instruction fetch (successive). an instruction fetch may be inserted between the read access and write access in a read-modify-write access. if an instruction is executed for two or more accesses, an instruction fetch and bus hold are not inserted between accesses due to bus size limitations. table 5-4. bus priority priority external bus cycle bus master bus hold external device dma transfer dmac operand data access cpu instruction fetch (branch) cpu high low instruction fetch (successive) cpu
chapter 5 bus control function user?s manual u16603ej5v1ud 221 5.10 bus timing figure 5-4. multiplexed bus read timing (bus size: 16 bits, 16-bit access) a1 a2 a3 d1 d2 a3 a2 a1 t1 t2 t3 t1 t2 tw tw t3 ti t1 programmable wait external wait idle state clkout a23 to a16 astb cs3 to cs0 wait ad15 to ad0 rd 8-bit access ad15 to ad8 ad7 to ad0 odd address active hi-z even address active hi-z remark the broken lines indicate high impedance. figure 5-5. multiplexed bus r ead timing (bus size: 8 bits) a1 a2 a3 d1 d2 a3 a2 a1 t1 t2 t3 t1 t2 tw tw t3 ti t1 programmable wait external wait idle state clkout a23 to a16, ad15 to ad8 astb cs3 to cs0 wait ad7 to ad0 rd remark the broken lines indicate high impedance.
chapter 5 bus control function user?s manual u16603ej5v1ud 222 figure 5-6. multiplexed bus write timi ng (bus size: 16 bits, 16-bit access) a1 11 00 11 11 00 11 a2 a3 d1 d2 a3 a2 a1 t2 t3 t1 t1 t2 tw tw t3 t1 programmable wait external wait clkout a23 to a16 astb cs3 to cs0 wait ad15 to ad0 wr1, wr0 8-bit access ad15 to ad8 ad7 to ad0 wr1, wr0 odd address active undefined even address undefined 01 10 active figure 5-7. multiplexed bus wr ite timing (bus size: 8 bits) a1 11 10 11 11 10 11 a2 a3 d1 d2 a3 a2 a1 t2 t3 t1 t1 t2 tw tw t3 t1 programmable wait external wait clkout a23 to a16, ad15 to ad8 astb cs3 to cs0 wait ad7 to ad0 wr1, wr0
chapter 5 bus control function user?s manual u16603ej5v1ud 223 figure 5-8. multiplexed bus hold timing (bus si ze: 16 bits, 16-bit access) t1 a1 undefined a1 a2 t2 t3 th th th th ti note ti note t1 t2 t3 d1 clkout hldrq hldak a23 to a16 astb cs3 to cs0 ad15 to ad0 rd undefined undefined undefined a2 d2 1111 1111 note this idle state (ti) does not de pend on the bcc register settings. remarks 1. see table 2-2 for the pin statuses in the bus hold mode. 2. the broken lines indicate high impedance.
chapter 5 bus control function user?s manual u16603ej5v1ud 224 figure 5-9. separate bus read timi ng (bus size: 16 bits, 16-bit access) t1 a1 a2 a3 t2 t1 tw tw t2 t2 ti t1 d3 d2 programmable wait external wait idle state d1 clkout a23 to a0 cs3 to cs0 wait ad15 to ad0 rd 8-bit access ad15 to ad8 ad7 to ad0 odd address active hi-z even address hi-z active remark the broken lines indicate high impedance. figure 5-10. separate bus r ead timing (bus size: 8 bits) t1 a1 a2 a3 t2 t1 tw tw t2 t2 ti t1 d3 d2 programmable wait external wait idle state d1 clkout a23 to a0 cs3 to cs0 wait ad7 to ad0 rd remark the broken lines indicate high impedance.
chapter 5 bus control function user?s manual u16603ej5v1ud 225 figure 5-11. separate bus write timi ng (bus size: 16 bits, 16-bit access) t1 a1 11 00 00 00 11 11 11 11 a2 a3 t2 t1 tw tw t2 t1 t2 d3 d2 programmable wait external wait d1 clkout a23 to a0 cs3 to cs0 wait ad15 to ad0 wr1, wr0 8-bit access ad15 to ad8 ad7 to ad0 wr1, wr0 odd address active undefined even address undefined 01 10 active remark the broken lines indicate high impedance. figure 5-12. separate bus writ e timing (bus size: 8 bits) t1 a1 a2 a3 t2 t1 tw tw t2 t1 t2 d3 d2 programmable wait external wait d1 clkout a23 to a0 cs3 to cs0 wait ad7 to ad0 wr1, wr0 11 10 10 10 11 11 11 11 remark the broken lines indicate high impedance.
chapter 5 bus control function user?s manual u16603ej5v1ud 226 figure 5-13. separate bus hold ti ming (bus size: 8 bits, write) clkout t1 t2 a1 d1 d2 undefined a2 undefined 11 11 10 d3 a3 t1 t2 th ti note ti note th th th t1 t2 hldrq hldak a23 to a0 ad7 to ad0 wr1, wr0 cs3 to cs0 11 10 11 10 1111 1111 11 note this idle state (ti) does not de pend on the bcc register settings. remark the broken lines indicate high impedance. figure 5-14. address wait timing (separate bus read, bus size: 16 bits, 16-bit access) tasw t1 tahw t2 clkout astb a23 to a0 cs3 to cs0 wait ad15 to ad0 rd d1 a1 t1 t2 clkout astb a23 to a0 cs3 to cs0 wait ad15 to ad0 rd d1 a1 remarks 1. tasw (address setup wait): image of hi gh-level width of t1 state expanded. 2. tahw (address hold wait): image of lo w-level width of t1 state expanded. 3. the broken lines indicate high impedance.
user?s manual u16603ej5v1ud 227 chapter 6 clock generation function 6.1 overview the following clock generation functions are available. { main clock oscillator ? in clock-through mode v850es/sj2: f x = 2.5 to 10 mhz (f xx = 2.5 to 10 mhz) v850es/sj2-h: f x = 2.5 to 8 mhz (f xx = 2.5 to 8 mhz) ? in pll mode v850es/sj2: f x = 2.5 to 5 mhz (f xx = 10 to 20 mhz) v850es/sj2-h: f x = 2.5 to 5 mhz ( 4: f xx = 10 to 20 mhz) f x = 2.5 to 4 mhz ( 8: f xx = 20 to 32 mhz) { subclock oscillator ? f xt = 32.768 khz { multiply ( 4/ 8) function by pll (phase locked loop) ? clock-through mode/pll mode selectable { internal oscillator ? f r = 200 khz (typ.) { internal system clock generation ? 7 steps (f xx , f xx /2, f xx /4, f xx /8, f xx /16, f xx /32, f xt ) { peripheral clock generation { clock output function remark f x : main clock oscillation frequency f xx : main clock frequency f xt : subclock frequency f r : internal oscillation clock frequency
chapter 6 clock generation function user?s manual u16603ej5v1ud 228 6.2 configuration figure 6-1. clock generator selector selector note frc bit mfrc bit mck bit ck2 to ck0 bits selpll bit pllon bit cls, ck3 bits stop mode subclock oscillator port cm prescaler 1 prescaler 2 idle control halt control halt mode cpu clock watch timer clock timer m clock watch timer clock, watchdog timer 2 clock peripheral clock, watchdog timer 2 clock watchdog timer 2 clock, timer m clock internal system clock prescaler 3 main clock oscillator main clock oscillator stop control rstop bit internal oscillator 1/8 divider xt1 xt2 clkout x1 x2 idle mode pll f xx /32 f xx /16 f xx /8 f xx /4 f xx /2 f xx f cpu f clk f xx to f xx /1,024 can controller f can f brg = f x /2 to f x /2 12 f xt f xt f xx f x f r f r /8 idle control selector selector note the internal oscillation clock is selected when t he watchdog timer 2 overflows during the oscillation stabilization time. remark f x : main clock oscillation frequency f xx : main clock frequency f clk : internal system clock frequency f xt : subclock frequency f cpu : cpu clock frequency f brg : watch timer clock frequency f r : internal oscillation clock frequency f can : can clock frequency
chapter 6 clock generation function user?s manual u16603ej5v1ud 229 (1) main clock oscillator the main resonator oscillates the following frequencies (f x ). ? in clock-through mode v850es/sj2: f x = 2.5 to 10 mhz v850es/sj2-h: f x = 2.5 to 8 mhz ? in pll mode v850es/sj2: f x = 2.5 to 5 mhz v850es/sj2-h: f x = 2.5 to 5 mhz ( 4) f x = 2.5 to 4 mhz ( 8) (2) subclock oscillator the sub-resonator oscillates a frequency of 32.768 khz (f xt ). (3) main clock oscillator stop control this circuit generates a control signal that stops oscillation of the main clock oscillator. oscillation of the main clock oscillat or is stopped in the stop mode or when the pcc.mck bit = 1 (valid only when the pcc.cls bit = 1). (4) internal oscillator oscillates a frequency (f r ) of 200 khz (typ.). (5) prescaler 1 this prescaler generates the clock (f xx to f xx /1,024) to be supplied to the following on-chip peripheral functions: tmp0 to tmp8, tmq0, tmm0, csib0 to csib5, uarta0 to uarta3, i 2 c00 to i 2 c02 note 1 , adc, wdt2, can0 note 2 , can1 note 3 , and iebus note 4 notes 1. i 2 c bus versions (y products) only 2. can controller versions only 3. can controller (2-channel) versions only 4. iebus versions only (6) prescaler 2 this circuit divides the main clock (f xx ). the clock generated by prescaler 2 (f xx to f xx /32) is supplied to the selector that generates the cpu clock (f cpu ) and internal system clock (f clk ). f clk is the clock supplied to the intc, rom correction, rom, and ram blocks, and can be output from the clkout pin. (7) prescaler 3 this circuit divides the clock generated by the main clock oscillator (f x ) to a specific frequency (32.768 khz) and supplies that clock to the watch timer block. for details, see chapter 10 watch timer functions . (8) pll this circuit multiplies the clock generated by the main clock oscillator (f x ) by 4 or 8. it operates in two modes: clock-through mode in which f x is output as is, and pll mode in which a multiplied clock is output. these modes can be sele cted by using the pllctl.selpll bit. whether the clock is multiplied by 4 or 8 is selected by the ckc.ckdiv0 bit, and pll is started or stopped by the pllctl.pllon bit.
chapter 6 clock generation function user?s manual u16603ej5v1ud 230 6.3 registers (1) processor clock control register (pcc) the pcc register is a special register. data can be wr itten to this register only in combination of specific sequences (see 3.4.8 special registers ). this register can be read or written in 8-bit or 1-bit units. reset input sets this register to 03h.
chapter 6 clock generation function user?s manual u16603ej5v1ud 231 frc used not used frc 0 1 use of subclock on-chip feedback resistor pcc mck mfrc cls note ck3 ck2 ck1 ck0 oscillation enabled oscillation stopped mck 0 1 main clock oscillator control used not used mfrc 0 1 use of main clock on-chip feedback resistor after reset: 03h r/w address: fffff828h main clock operation subclock operation cls note 0 1 status of cpu clock (f cpu ) < > < > < > f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 setting prohibited f xt ck2 0 0 0 0 1 1 1 clock selection (f clk /f cpu ) ck1 0 0 1 1 0 0 1 ck0 0 1 0 1 0 1 ck3 0 0 0 0 0 0 0 1 even if the mck bit is set (1) while the system is operating with the main clock as the cpu clock, the operation of the main clock does not stop. it stops after the cpu clock has been changed to the subclock. before setting the mck bit from 0 to 1, stop the on-chip peripheral functions operating with the main clock. when the main clock is stopped and the device is operating with the subclock, clear (0) the mck bit and secure the oscillation stabilization time by software before switching the cpu clock to the main clock or operating the on-chip peripheral functions. ? ? ? note the cls bit is a read-only bit. cautions 1. do not change the cpu clock (by using the ck3 to ck0 bits) while clkout is being output. 2. use a bit manipulation instruction to ma nipulate the ck3 bit. when using an 8-bit manipulation instruction, do not change the set values of the ck2 to ck0 bits. remark : don?t care
chapter 6 clock generation function user?s manual u16603ej5v1ud 232 (a) example of setting main clock operation subclock operation <1> ck3 bit 1: use of a bit manipulation instructi on is recommended. do not change the ck2 to ck0 bits. <2> subclock operation: read the cls bit to check if subclock operation has started. it takes the following time after the ck3 bit is se t until subclock operation is started. max.: 1/f xt (1/subclock frequency) <3> mck bit 1: set the mck bit to 1 only when stopping the main clock. cautions 1. when stopping the ma in clock, stop the pll. also stop the operations of the on-chip peripheral functions operati ng with the main clock. 2. if the following conditions are not satisfi ed, change the ck2 to ck0 bits so that the conditions are satisfied, then change to the subclock operation mode. internal system clock (f clk ) > subclock (f xt : 32.768 khz) 4 remark internal system clock (f clk ): clock generated from the main clock (f xx ) by setting bits ck2 to ck0 [description example] _dma_disable: clrl 0, dchcn[r0] -- dma operation disabled. n = 0 to 3 <1> _set_sub_run : st.b r0, prcmd[r0] set1 3, pcc[r0] -- ck3 bit 1 <2> _check_cls : tst1 4, pcc[r0] -- wait until subclock operation starts. bz _check_cls <3> _stop_main_clock : st.b r0, prcmd[r0] set1 6, pcc[r0] -- mck bit 1, main clock is stopped. _dma_enable: setl 0, dchcn[r0] -- dma operation enabled. n = 0 to 3 remark the description above is simply an example. no te that in <2> above, the cls bit is read in a closed loop.
chapter 6 clock generation function user?s manual u16603ej5v1ud 233 (b) example of setting subclock operation main clock operation <1> mck bit 0: main clock starts oscillating <2> insert waits by the program and wait until the oscillation stabilizat ion time of the main clock elapses. <3> ck3 bit 0: use of a bit manipulation instruction is recommended. do not change the ck2 to ck0 bits. <4> main clock operation: it takes the following time after the ck3 bit is set until main clock operation is started. max.: 1/f xt (1/subclock frequency) therefore, insert one nop instructi on immediately after setting the ck3 bit to 0 or read the cls bit to check if main clock operation has started. caution enable operation of the on-chip peripher al functions operating with the main clock only after the oscillation of the main clock stabilizes. if their operations are enabled before the lapse of the oscillation stabilizat ion time, a malfunction may occur. [description example] _dma_disable: clrl 0, dchcn[r0] -- dma operation disabled. n = 0 to 3 <1> _start_main_osc : st.b r0, prcmd[r0] -- release of protection of special registers clr1 6, pcc[r0] -- main clock starts oscillating. <2> movea 0x55, r0, r11 -- wait for oscillation stabilization time. _wait_ost : nop nop nop addi -1, r11, r11 cmp r0, r11 bne _wait_ost <3> st.b r0, prcmd[r0] clr1 3, pcc[r0] -- ck3 0 <4> _check_cls : tst1 4, pcc[r0] -- wait until main clock operation starts. bnz _check_cls _dma_enable: setl 0, dchcn[r0] -- dma operation enabled. n = 0 to 3 remark the description above is simply an example. no te that in <4> above, the cls bit is read in a closed loop.
chapter 6 clock generation function user?s manual u16603ej5v1ud 234 (2) internal oscillati on mode register (rcm) the rcm register is an 8-bit register that sets the operation mode of the internal oscillator. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 rcm 0 0 0 00 0 rstop internal oscillator oscillating internal oscillator stopped rstop 0 1 oscillation/stop of internal oscillator after reset: 00h r/w address: fffff80ch < > cautions 1. the internal osc illator cannot be stopped while the cpu is operating on the internal oscillation clock (ccls.cclsf bit = 1). do not set the rstop bit to 1. 2. the internal oscillator oscillates if the ccls.cclsf bit is set to 1 (when wdt overflow occurs during oscillation stabilization) even wh en the rstop bit is set to 1. at this time, the rstop bit rema ins being set to 1. (3) cpu operation clock status register (ccls) the ccls register indicates the stat us of the cpu operation clock. this register is read-only, in 8-bit or 1-bit units. reset sets this register to 00h. 0 ccls 0 0 0 0 0 0 cclsf after reset: 00h note r address: fffff82eh operating on main clock (f x ) or subclock (f xt ). operating on internal oscillation clock (f r ). cclsf 0 1 cpu operation clock status note if wdt overflow occurs during oscillation stabilizati on after a reset is released, the cpu operates on the internal oscillation clock (f r ). at this time, the cclsf bit is set to 1 and the reset value is 01h.
chapter 6 clock generation function user?s manual u16603ej5v1ud 235 6.4 operation 6.4.1 operation of each clock the following table shows the oper ation status of each clock. table 6-1. operation status of each clock pcc register clk bit = 0, mck bit = 0 cls bit = 1, mck bit = 0 cls bit = 1, mck bit = 1 register setting and operation status target clock during reset during oscillation stabilization time count halt mode idle1, idle2 mode stop mode subclock mode sub-idle mode subclock mode sub-idle mode main clock oscillator (f x ) subclock oscillator (f xt ) cpu clock (f cpu ) internal system clock (f clk ) main clock (in pll mode, f xx ) note peripheral clock (f xx to f xx /1,024) wt clock (main) wt clock (sub) wdt2 clock (internal oscillation) wdt2 clock (main) wdt2 clock (sub) note lockup time remark : operable : stopped 6.4.2 clock output function the clock output function is used to output the internal system clock (f clk ) from the clkout pin. the internal system clock (f clk ) is selected by using the pcc.ck3 to pcc.ck0 bits. the clkout pin functions alte rnately as the pcm1 pin and functions as a clock output pin if so specified by the control register of port cm. the status of the clko ut pin is the same as the in ternal system clock in table 6-1 and the pin can output the clock when it is in the operable status. it outputs a low level in the stopped stat us. however, the clkout pin is in the port mode (pcm1 pin: input mode) after reset and until it is set in the output mode. ther efore, the stat us of the pin is hi-z.
chapter 6 clock generation function user?s manual u16603ej5v1ud 236 6.5 pll function 6.5.1 overview in the v850es/sj2 and v850es/sj2-h, an oper ating clock that is 4 or 8 times hi gher than the oscillation frequency output by the pll function or the clock-through mode can be selected as the operating clock of the cpu and on-chip peripheral functions. ? v850es/sj2 when pll function is used: input clock = 2.5 to 5 mhz (output: 10 to 20 mhz) clock-through mode: input clock = 2.5 to 10 mhz (output: 2.5 to 10 mhz) ? v850es/sj2-h when pll function is used ( 4): input clock = 2.5 to 5 mhz (output: 10 to 20 mhz) when pll function is used ( 8): input clock = 2.5 to 4 mhz (output: 20 to 32 mhz) clock-through mode: input clock = 2.5 to 8 mhz (output: 2.5 to 8 mhz) 6.5.2 registers (1) pll control register (pllctl) the pllctl register is an 8-bit regi ster that controls the pll function. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 01h. 0 pllctl 0 0 0 00 selpll pllon pll stopped pll operating (after pll operation starts, a lockup time is required for frequency stabilization) pllon 0 1 pll operation stop register clock-through mode pll mode selpll 0 1 cpu operation clock selection register after reset: 01h r/w address: fffff82ch < > < > cautions 1. to stop the pll operation, first set th e clock through mode (selpll bit = 0), wait for at least 8 clocks, and then stop the pll (pllon bit = 0). when the pllon bit is cleared to 0, the selpll bit is automatically cleared to 0 (clock-through mode), but be sure to stop the pll in the above procedure. 2. the selpll bit can be set to 1 only when the pll clock frequency is stabilized. if not (unlocked), ?0? is written to the sel pll bit if data is written to it.
chapter 6 clock generation function user?s manual u16603ej5v1ud 237 (2) clock control register (ckc) the ckc register is a special register. data can be wri tten to this register only in a combination of specific sequence (see 3.4.8 special registers ). the ckc register controls the inte rnal system clock in the pll mode. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 0ah. 0 ckc 0 0 0 1 0 1 ckdiv0 after reset: 0ah r/w address: fffff822h f xx = 4 f x (f x = 2.5 to 5.0 mhz) ckdiv0 0 1 internal system clock (f xx ) in pll mode v850es/sj2: f xx = 8 f x (f x = 2.5 mhz) v850es/sj2-h: f xx = 8 f x (f x = 2.5 to 4.0 mhz) cautions 1. the pll mode cannot be used in case of the following oscillation frequency. ? v850es/sj2: 5.0 mhz < f x 10.0 mhz ? v850es/sj2-h: 5.0 mhz < f x 8.0 mhz 2. before changing the mult iplication factor between 4 a nd 8 by using the ckc register, set the clock-through mode and stop the pll. 3. be sure to set bits 3 and 1 to ?1 ? and clear bits 7 to 4 and 2 to ?0?. remark both the cpu clock and peripheral clock are divided by the ckc register, but only the cpu clock is divided by the pcc register.
chapter 6 clock generation function user?s manual u16603ej5v1ud 238 (3) lock register (lockr) phase lock occurs at a given frequency following powe r application or immediately after the stop mode is released, and the time required for stabilization is the lockup time (frequency stabilization time). this state until stabilization is called the lock up status, and the stabilized state is called the locked status. the lockr register includes a lock bit that re flects the pll frequency stabilization status. this register is read-only, in 8-bit or 1-bit units. reset sets this register to 00h. 0 lockr 0 0 0 00 0 lock locked status unlocked status lock 0 1 pll lock status check after reset: 00h r address: fffff824h < > caution the lock register does not reflect the lock status of the p ll in real time. the set/clear conditions are as follows. [set conditions] ? upon system reset note ? in idle2 or stop mode ? upon setting of pll stop (clearing of pllctl.pllon bit to 0) ? upon stopping main clock and using cpu with subclock (setting of pcc.ck3 bit to 1 and setting of pcc.mck bit to 1) note this register is set to 01h by reset and cleared to 00h after the reset has been released and the oscillation stabilization time has elapsed. [clear conditions] ? upon overflow of oscillation stabilization time fo llowing reset release (osts register default time (see 24.2 (3) oscillation stabilization time select register (osts) )) ? upon oscillation stabilization timer overflow (time set by osts register) following stop mode release, when the stop mode was set in the pll operating status ? upon pll lockup time timer overflow (time set by plls register) when the pllctl.pllon bit is changed from 0 to 1 ? after the setup time inserted upon release of the idle2 mode is released (time set by the osts register) when the idle2 mode is set during pll operation.
chapter 6 clock generation function user?s manual u16603ej5v1ud 239 (4) pll lockup time specification register (plls) the plls register is an 8-bit register used to sele ct the pll lockup time when the pllctl.pllon bit is changed from 0 to 1. this register can be read or written in 8-bit units. reset sets this register to 03h. 0 2 10 /f x 2 11 f x 2 12 /f x 2 13 /f x (default value) plls1 0 0 1 1 plls0 0 1 0 1 selection of pll lockup time plls 0 0 0 0 0 plls1 plls0 after reset: 03h r/w address: fffff6c1h cautions 1. set so that the lockup time is 800 s or longer. 2. do not change the plls regi ster setting during the lockup period. 6.5.3 usage (1) when pll is used ? after the reset signal has been released, the pll operates (pllctl.pllon bit = 1), but because the default mode is the clock-through mode (pllctl.selpll bi t = 0), select the pll mode (selpll bit = 1). ? to enable pll operation, first set the pllon bit to 1, and then set the selpll bit to 1 after the lockr.lock bit = 0. to stop the pll, first select the clock-through mode (selpll bit = 0), wait for 8 clocks or more, and then stop the pll (pllon bit = 0). ? the pll stops during transition to idle2 or stop m ode regardless of the setting and is restored from idle2 or stop mode to the status before transition. the time requir ed for restoration is as follows. (a) to set the idle2/stop mode in clock through mode ? stop mode: set the osts register so that the o scillation stabilization time is 1 ms (min.) or more. ? idle2 mode: set the osts register so that the setup time is 350 s (min.) or more. (b) to set idle2/stop mode in pll operation mode ? stop mode: set the osts register so that the o scillation stabilization time is 1 ms (min.) or more. ? idle2 mode: set the osts register so that the setup time is 800 s (min.) or more. when shifting to the idle1 mode, the pll d oes not stop. stop the pll if necessary. (2) when pll is not used ? the clock-through mode (selpll bit = 0) is selected a fter the reset signal has been released, but the pll is operating (pllon bit = 1) and must t herefore be stopped (pllon bit = 0).
user?s manual u16603ej5v1ud 240 chapter 7 16-bit timer/event counter p (tmp) timer p (tmp) is a 16-bit timer/event counter. the v850es/sj2 and v850es/sj2-h have six timer/event counter channels, tmp0 to tmp8. 7.1 overview an outline of tmpn is shown below. ? clock selection: 8 ways ? capture/trigger input pins: 2 ? external event count input pins: 1 ? external trigger input pins: 1 ? timer/counters: 1 ? capture/compare registers: 2 ? capture/compare match interrupt request signals: 2 ? overflow interrupt request signals: 1 ? timer output pins: 2 remark n = 0 to 8 7.2 functions tmpn has the following functions. ? interval timer ? external event counter ? external trigger pulse output ? one-shot pulse output ? pwm output ? free-running timer ? pulse width measurement remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 241 7.3 configuration tmpn includes the following hardware. table 7-1. configuration of tmpn item configuration timer register 16-bit counter registers tmpn capture/compare registers 0, 1 (tpnccr0, tpnccr1) tmpn counter read buffer register (tpncnt) ccr0, ccr1 buffer registers timer inputs 2 (tipn0 note 1 , tipn1 pins) timer outputs 2 (topn0, topn1 pins) control registers note 2 tmpn control registers 0, 1 (tpnctl0, tpnctl1) tmpn i/o control registers 0 to 2 (tpnioc0 to tpnioc2) tmpn option register 0 (tpnopt0) notes 1. the tipn0 pin functions alternately as a capture trigger input signal, external event count input signal, and external trigger input signal. 2. when using the functions of the tipn0, tipn1, topn0, and topn1 pins, see table 4-19 using port pin as alternate-function pin . remark n = 0 to 8 figure 7-1. block diagram of tmpn f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 note 1 , f xx /256 note 2 f xx /128 note 1 , f xx /512 note 2 selector internal bus internal bus topn0 topn1 tipn0 tipn1 selector edge detector ccr0 buffer register ccr1 buffer register tpnccr0 tpnccr1 16-bit counter tpncnt inttpnov inttpncc0 inttpncc1 output controller clear notes 1. tmp0, tmp2, tmp4, tmp6, tmp8 2. tmp1, tmp3, tmp5, tmp7 remark f xx : main clock frequency
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 242 (1) 16-bit counter this 16-bit counter can count inte rnal clocks or external events. the count value of this counter can be read by using the tpncnt register. when the tpnctl0.tpnce bit = 0, the va lue of the 16-bit counter is ffffh. if the tpncnt register is read at this time, 0000h is read. reset sets the tpnce bit to 0. (2) ccr0 buffer register this is a 16-bit compare register that com pares the count value of the 16-bit counter. when the tpnccr0 register is used as a compare regist er, the value written to the tpnccr0 register is transferred to the ccr0 buffer register. when the count value of the 16-bit counter matches the value of the ccr0 buffer register, a compare match interrupt request signal (inttpncc0) is generated. the ccr0 buffer register cannot be read or written directly. the ccr0 buffer register is cleared to 0000h after reset, as the tpnccr0 register is cleared to 0000h. (3) ccr1 buffer register this is a 16-bit compare register that com pares the count value of the 16-bit counter. when the tpnccr1 register is used as a compare regist er, the value written to the tpnccr1 register is transferred to the ccr1 buffer register. when the count value of the 16-bit counter matches the value of the ccr1 buffer register, a compare match interrupt request signal (inttpncc1) is generated. the ccr1 buffer register cannot be read or written directly. the ccr1 buffer register is cleared to 0000h after reset, as the tpnccr1 register is cleared to 0000h. (4) edge detector this circuit detects the valid edges input to the tipn0 and tipn1 pins. no edge, rising edge, falling edge, or both the rising and falling edges can be selected as the valid edge by using the tpnioc1 and tpnioc2 registers. (5) output controller this circuit controls the output of the topn0 and topn 1 pins. the output contro ller is controlled by the tpnioc0 register. (6) selector this selector selects the count clock for the 16-bit counter . eight types of internal clocks or an external event can be selected as the count clock.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 243 7.4 registers the registers that control tmpn are as follows. ? tmpn control register 0 (tpnctl0) ? tmpn control register 1 (tpnctl1) ? tmpn i/o control register 0 (tpnioc0) ? tmpn i/o control register 1 (tpnioc1) ? tmpn i/o control register 2 (tpnioc2) ? tmpn option register 0 (tpnopt0) ? tmpn capture/compare register 0 (tpnccr0) ? tmpn capture/compare register 1 (tpnccr1) ? tmpn counter read buffer register (tpncnt) remarks 1. when using the functions of the tipn0, tipn1,to pn0, and topn1 pins, see table 4-19 using port pin as alternate-function pin . 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 244 (1) tmpn control register 0 (tpnctl0) the tpnctl0 register is an 8-bit register that controls the operation of tmpn. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. the same value can always be written to the tpnctl0 register by software. tpnce tmpn operation disabled (tmpn reset asynchronously note ). tmpn operation enabled. tmpn operation started. tpnce 0 1 tmpn operation control tpnctl0 (n = 0 to 8) 0 0 0 0 tpncks2 tpncks1 tpncks0 654321 after reset: 00h r/w address: tp0ctl0 fffff590h, tp1ctl0 fffff5a0h, tp2ctl0 fffff5b0h, tp3ctl0 fffff5c0h, tp4ctl0 fffff5d0h, tp5ctl0 fffff5e0h, tp6ctl0 fffff5f0h, tp7ctl0 fffff600h, tp8ctl0 fffff610h <7> 0 f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 f xx /128 f xx /256 f xx /512 tpncks2 0 0 0 0 1 1 1 1 internal count clock selection n = 0, 2, 4, 6, 8 n = 1, 3, 5, 7 tpncks1 0 0 1 1 0 0 1 1 tpncks0 0 1 0 1 0 1 0 1 note the tpnopt0.tpnovf bit and 16-bit counter are re set at the same time. in addition, the timer output pins (topn0 and topn1 pins) are reset to t he status set by the tpnioc0 register when the 16-bit counter is reset. cautions 1. set the tpncks2 to tpncks0 bits when the tpnce bit = 0. when the value of the tpnce bit is change d from 0 to 1, the tpncks2 to tpncks0 bits can be set simultaneously. 2. be sure to clear bits 3 to 6 to ?0?. remark f xx : main clock frequency (2) tmpn control register 1 (tpnctl1) the tpnctl1 register is an 8-bit register that controls the operation of tmpn. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 245 0 tpnest 0 1 software trigger control tpnctl1 (n = 0 to 8) tpnest tpneee 0 0 tpnmd2 tpnmd1 tpnmd0 <6> <5> 4 3 2 1 after reset: 00h r/w address: tp0ctl1 fffff591h, tp1ctl1 fffff5a1h, tp2ctl1 fffff5b1h, tp3ctl1 fffff5c1h, tp4ctl1 fffff5d1h, tp5ctl1 fffff5e1h, tp6ctl1 fffff5f1h, tp7ctl1 fffff601h, tp8ctl1 fffff611h generate a valid signal for external trigger input. ? in one-shot pulse output mode: a one-shot pulse is output with writing 1 to the tpnest bit as the trigger. ? in external trigger pulse output mode: a pwm waveform is output with writing 1 to the tpnest bit as the trigger. disable operation with external event count input (tipn0 pin). (perform counting with the count clock selected by the tpnctl0.tpncks0 to tpncks2 bits.) tpneee 0 1 count clock selection the tpneee bit selects whether counting is performed with the internal count clock or the valid edge of the external event count input. 7 0 interval timer mode external event count mode external trigger pulse output mode one-shot pulse output mode pwm output mode free-running timer mode pulse width measurement mode setting prohibited tpnmd2 0 0 0 0 1 1 1 1 timer mode selection tpnmd1 0 0 1 1 0 0 1 1 tpnmd0 0 1 0 1 0 1 0 1 enable operation with external event count input (tipn0 pin). (perform counting at the valid edge of the external event count input signal (tipn0 pin).) ? the read value of the tpnest bit is always 0. cautions 1. the tpnest bit is valid only in the external trigger pulse output mode or the one-shot pulse output mode. in any other mode, writing 1 to this bit is ignored. 2. external event count input is selected in the external event count mode regardless of the value of the tpneee bit. 3. set the tpneee and tpnmd2 to tpnmd0 bits when the tpnctl0.tpnce bit = 0. (the same value can be written when the tpnce bi t = 1.) the operation is not guaranteed when rewriting is performed with the tpnc e bit = 1. if rewriting was mistakenly performed, clear the tpnce bit to 0 and then set the bits again. 4. be sure to clear bits 3, 4, and 7 to ?0?.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 246 (3) tmpn i/o control register 0 (tpnioc0) the tpnioc0 register is an 8-bit register that controls the timer output (topn0, topn1 pins). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 247 0 tpnol1 0 1 topn1 pin output level setting note topn1 pin high level start topn1 pin low level start tpnioc0 (n = 0 to 8) 0 0 0 tpnol1 tpnoe1 tpnol0 tpnoe0 6543<2>1 after reset: 00h r/w address: tp0ioc0 fffff592h, tp1ioc0 fffff5a2h, tp2ioc0 fffff5b2h, tp3ioc0 fffff5c2h, tp4ioc0 fffff5d2h, tp5ioc0 fffff5e2h, tp6ioc0 fffff5f2h, tp7ioc0 fffff602h, tp8ioc0 fffff612h tpnoe1 0 1 topn1 pin output setting timer output disabled ? when tpnol1 bit = 0: low level is output from the topn1 pin ? when tpnol1 bit = 1: high level is output from the topn1 pin tpnol0 0 1 topn0 pin output level setting note topn0 pin high level start topn0 pin low level start tpnoe0 0 1 topn0 pin output setting timer output disabled ? when tpnol0 bit = 0: low level is output from the topn0 pin ? when tpnol0 bit = 1: high level is output from the topn0 pin 7 <0> timer output enabled (a pulse is output from the topn1 pin). timer output enabled (a pulse is output from the topn0 pin). note the output level of the timer out put pins (topn0, topn1) specifie d by the tpnolm bit is shown below (m = 0, 1). tpnce bit topnm pin output 16-bit counter ? when tpnolm bit = 0 tpnce bit topnm pin output 16-bit counter ? when tpnolm bit = 1 cautions 1. the pin output changes if the setting of the tpnioc0 register is rewritten when the port is set to output topn0 and topn1. therefore, note changes in the pin status by setting the port to the input mode and making the output status of the pins a high-impedance state. 2. rewrite the tpnol1, tpnoe1, tpnol0, a nd tpnoe0 bits when the tpnctl0.tpnce bit = 0. (the same value can be written when the tpnce bit = 1.) if rewriting was mistakenly performed, clear the tpnce bi t to 0 and then set the bits again. 3. even if the tpnolm bit is manipulated when the tpnce and tpnoem bits are 0, the topnm pin output level varies (m = 0, 1).
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 248 (4) tmpn i/o control register 1 (tpnioc1) the tpnioc1 register is an 8-bit regist er that controls the valid edge of the capture trig ger input signals (tipn0, tipn1 pins). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 tpnis3 0 0 1 1 tpnis2 0 1 0 1 capture trigger input signal (tipn1 pin) valid edge setting no edge detection (capture operation invalid) detection of rising edge detection of falling edge detection of both edges tpnioc1 (n = 0 to 8) 0 0 0 tpnis3 tpnis2 tpnis1 tpnis0 654321 after reset: 00h r/w address: tp0ioc1 fffff593h, tp1ioc1 fffff5a3h, tp2ioc1 fffff5b3h, tp3ioc1 fffff5c3h, tp4ioc1 fffff5d3h, tp5ioc1 fffff5e3h, tp6ioc1 fffff5f3h, tp7ioc1 fffff603h, tp8ioc1 fffff613h tpnis1 0 0 1 1 tpnis0 0 1 0 1 capture trigger input signal (tipn0 pin) valid edge setting no edge detection (capture operation invalid) detection of rising edge detection of falling edge detection of both edges 7 0 cautions 1. rewrite the tpnis3 to tpnis0 bits when the tpnctl0.tpnce bit = 0. (the same value can be written when the tpnce bit = 1.) if rewriting was mistakenly performed, clear the tpnce bit to 0 and then set the bits again. 2. the tpnis3 to tpnis0 bits are valid only in the free-running timer mode (only when tpnopt0.tpnccs1, tpnccs0 bits = 11) and the pulse width measurement mode. in all other modes, a capture operation is not possible.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 249 (5) tmpn i/o control register 2 (tpnioc2) the tpnioc2 register is an 8-bit register that controls the valid edge of the external event count input signal (tipn0 pin) and external trigger input signal (tipn0 pin). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 tpnees1 0 0 1 1 tpnees0 0 1 0 1 external event count input signal (tipn0 pin) valid edge setting no edge detection (external event count invalid) detection of rising edge detection of falling edge detection of both edges tpnioc2 (n = 0 to 8) 0 0 0 tpnees1 tpnees0 tpnets1 tpnets0 654321 after reset: 00h r/w address: tp0ioc2 fffff594h, tp1ioc2 fffff5a4h, tp2ioc2 fffff5b4h, tp3ioc2 fffff5c4h, tp4ioc2 fffff5d4h, tp5ioc2 fffff5e4h, tp6ioc2 fffff5f4h, tp7ioc2 fffff604h, tp8ioc2 fffff614h tpnets1 0 0 1 1 tpnets0 0 1 0 1 external trigger input signal (tipn0 pin) valid edge setting no edge detection (external trigger invalid) detection of rising edge detection of falling edge detection of both edges 7 0 cautions 1. rewrite the tpnees1, tpnees0, tpnets1, and tpnets0 bits when the tpnctl0.tpnce bit = 0. (the same value can be written wh en the tpnce bit = 1.) if rewriting was mistakenly performed, clear the tpnce bit to 0 and then set the bits again. 2. the tpnees1 and tpnees0 bits are valid only when the tpnctl1.tpneee bit = 1 or when the external event count mode (t pnctl1.tpnmd2 to tpnctl1.tpnmd0 bits = 001) has been set. 3. the tpnets1 and tpnets0 bits are valid only when the external trigger pulse output mode (tpnctl1.tpnmd2 to tp nctl1.tpnmd0 bits = 010) or the one-shot pulse output mode (tpnctl1.tpnmd2 to tpnctl1.tpnmd0 = 011) is set.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 250 (6) tmpn option register 0 (tpnopt0) the tpnopt0 register is an 8-bit register used to set the capture/compare operation and detect an overflow. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 tpnccs1 0 1 tpnccr1 register capture/compare selection the tpnccs1 bit setting is valid only in the free-running timer mode. compare register selected capture register selected (cleared by setting tpnctl0.tpnce bit = 0) tpnopt0 (n = 0 to 8) 0 tpnccs1 tpnccs0 0 0 0 tpnovf 654321 after reset: 00h r/w address: tp0opt0 fffff595h, tp1opt0 fffff5a5h, tp2opt0 fffff5b5h, tp3opt0 fffff5c5h, tp4opt0 fffff5d5h, tp5opt0 fffff5e5h, tp6opt0 fffff5f5h, tp7opt0 fffff605h, tp8opt0 fffff615h tpnccs0 0 1 tpnccr0 register capture/compare selection the tpnccs0 bit setting is valid only in the free-running timer mode. compare register selected capture register selected (cleared by setting tpnctl0.tpnce bit = 0) tpnovf set (1) reset (0) tmpn overflow detection flag ? the tpnovf bit is set to 1 when the 16-bit counter count value overflows from ffffh to 0000h in the free-running timer mode or the pulse width measurement mode. ? an overflow interrupt request signal (inttpnov) is generated at the same time that the tpnovf bit is set to 1. the inttpnov signal is not generated in modes other than the free-running timer mode and the pulse width measurement mode. ? the tpnovf bit is not cleared to 0 even when the tpnovf bit or the tpnopt0 register are read when the tpnovf bit = 1. ? before clearing the tpnovf bit to 0 after the inttpnov signal has been generated, be sure to confirm (read) that the tpnovf bit is set to 1. ? the tpnovf bit can be both read and written, but the tpnovf bit cannot be set to 1 by software. writing 1 has no influence on the operation of tmpn. overflow occurred tpnovf bit 0 written or tpnctl0.tpnce bit = 0 7 <0> cautions 1. rewrite the tpnccs1 and tpnccs0 bits when the tpnce bit = 0. (the same value can be written when the tpnce bit = 1.) if re writing was mistakenly performed, clear the tpnce bit to 0 and then set the bits again. 2. be sure to clear bits 1 to 3, 6, and 7 to ?0?.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 251 (7) tmpn capture/compare register 0 (tpnccr0) the tpnccr0 register is a 16-bit re gister that can be used as a capture register or a compare register depending on the mode. this register can be used as a capture register or a compare register only in the free-running timer mode, depending on the setting of the tpnopt0.tpnccs0 bit. in the pulse width measurement mode, the tpnccr0 register can be used only as a capt ure register. in any other mode, this register can be used only as a compare register. the tpnccr0 register can be r ead or written during operation. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the tpnccr0 register is prohibited in the following statuses. for details, see 3.4.9 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock a nd the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tpnccr0 (n = 0 to 8) 12 10 8 6 4 2 after reset: 0000h r/w address: tp0ccr0 fffff596h, tp1ccr0 fffff5a6h, tp2ccr0 fffff5b6h, tp3ccr0 fffff5c6h, tp4ccr0 fffff5d6h, tp5ccr0 fffff5e6h, tp6ccr0 fffff5f6h, tp7ccr0 fffff606h, tp8ccr0 fffff616h 14 0 13 11 9 7 5 3 15 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 252 (a) function as compare register the tpnccr0 register can be rewritten even when the tpnctl0.tpnce bit = 1. the set value of the tpnccr0 register is transferred to the ccr0 buffer register. when the value of the 16-bit counter matches the value of the ccr0 buffer register, a compare match interrupt request signal (inttpncc0) is generated. if topn0 pin output is ena bled at this time, the output of the topn0 pin is inverted. when the tpnccr0 register is used as a cycle register in the interval timer mode, external event count mode, external trigger pulse output mode, one-shot pulse output mode, or pwm output mode, the value of the 16-bit counter is cleared (0000h) if its count va lue matches the value of the ccr0 buffer register. the compare register is not cleared when the tpnctl0.tpnce bit = 0. (b) function as capture register when the tpnccr0 register is used as a capture regi ster in the free-running timer mode, the count value of the 16-bit counter is stored in the tpnccr0 register if the valid ed ge of the capture trigger input pin (tipn0 pin) is detected. in the pulse-width measurement mode, the co unt value of the 16-bit counter is stored in the tpnccr0 register and the 16-bit counter is cleared (0000h) if the valid edge of the capture trigger input pin (tipn0) is detected. even if the capture operation and reading the tpn ccr0 register conflict, the correct value of the tpnccr0 register can be read. the capture register is cleared when the tpnctl0.tpnce bit = 0. remark n = 0 to 8 the following table shows the functions of the capture/compare re gister in each mode, and how to write data to the compare register. table 7-2. function of capture/co mpare register in each mode a nd how to write compare register operation mode capture/compare register how to write compare register interval timer compare register anytime write external event counter compare register anytime write external trigger pulse output compare register batch write note one-shot pulse output compare register anytime write pwm output compare register batch write note free-running timer capture/compare register anytime write pulse width measurement capture register none note triggered by writing to the tpnccr1 register remark for details of anytime write and batch write, see 7.6 (2) anytime write and batch write .
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 253 (8) tmpn capture/compare register 1 (tpnccr1) the tpnccr1 register is a 16-bit re gister that can be used as a capture register or a compare register depending on the mode. this register can be used as a capture register or a compare register only in the free-running timer mode, depending on the setting of the tpnopt0.tpnccs1 bit. in the pulse width measurement mode, the tpnccr1 register can be used only as a capt ure register. in any other mode, this register can be used only as a compare register. the tpnccr1 register can be r ead or written during operation. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the tpnccr1 register is prohibi ted in the following stat uses. for details, see 3.4.9 (2) accessing specific on-ch ip peripheral i/o registers. ? when the cpu operates with the subclock a nd the main clock oscillation is stopped ? when the cpu operates with th e internal oscillation clock tpnccr1 (n = 0 to 8) 12 10 8 6 4 2 after reset: 0000h r/w address: tp0ccr1 fffff598h, tp1ccr1 fffff5a8h, tp2ccr1 fffff5b8h, tp3ccr1 fffff5c8h, tp4ccr1 fffff5d8h, tp5ccr1 fffff5e8h, tp6ccr1 fffff5f8h, tp7ccr1 fffff608h, tp8ccr1 fffff618h 14 0 13 11 9 7 5 3 15 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 254 (a) function as compare register the tpnccr1 register can be rewritten even when the tpnctl0.tpnce bit = 1. the set value of the tpnccr1 register is transferred to the ccr1 buffer register. when the value of the 16-bit counter matches the value of the ccr1 buffer register, a compare match interrupt request signal (inttpncc1) is generated. if topn1 pin output is ena bled at this time, the output of the topn1 pin is inverted. the compare register is not cleared when the tpnctl0.tpnce bit = 0. (b) function as capture register when the tpnccr1 register is used as a capture regi ster in the free-running timer mode, the count value of the 16-bit counter is stored in the tpnccr1 register if the valid ed ge of the capture trigger input pin (tipn1 pin) is detected. in the pulse-width measurement mode, the co unt value of the 16-bit counter is stored in the tpnccr1 register and the 16-bit counter is cleared (0000h) if the valid edge of the capture trigger input pin (tipn1) is detected. even if the capture operation and reading the tpn ccr1 register conflict, the correct value of the tpnccr1 register can be read. the capture register is cleared when the tpnctl0.tpnce bit = 0. remark n = 0 to 8 the following table shows the functions of the capture/compare re gister in each mode, and how to write data to the compare register. table 7-3. function of capture/co mpare register in each mode a nd how to write compare register operation mode capture/compare register how to write compare register interval timer compare register anytime write external event counter compare register anytime write external trigger pulse output compare register batch write note one-shot pulse output compare register anytime write pwm output compare register batch write note free-running timer capture/compare register anytime write pulse width measurement capture register none note triggered by writing to the tpnccr1 register remark for anytime write and batch write, see 7.6 (2) anytime write and batch write .
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 255 (9) tmpn counter read bu ffer register (tpncnt) the tpncnt register is a read buffer register that can read the count va lue of the 16-bit counter. if this register is read when the tpnctl0.tpnce bit = 1, the count value of the 16-bit timer can be read. this register is read-only, in 16-bit units. the value of the tpncnt register is cleared to 0000h when the tpnce bit = 0. if the tpncnt register is read at this time, the value of the 16-bit count er (ffffh) is not read, but 0000h is read. the value of the tpncnt register is cleared to 000 0h after reset, as the tpnce bit is cleared to 0. caution accessing the tpncnt regist er is prohibited in th e following statuses. for details, see 3.4.9 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock a nd the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tpncnt (n = 0 to 8) 12 10 8 6 4 2 after reset: 0000h r address: tp0cnt fffff59ah, tp1cnt fffff5aah, tp2cnt fffff5bah, tp3cnt fffff5cah, tp4cnt fffff5dah, tp5cnt fffff5eah, tp6cnt fffff5fah, tp7cnt fffff60ah, tp8cnt fffff61ah 14 0 13 11 9 7 5 3 15 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 256 7.5 timer output operations the following table shows the operations and out put levels of the topn0 and topn1 pins. table 7-4. timer output control in each mode operation mode topn1 pin topn0 pin interval timer mode square wave output external event count mode none external trigger pulse output mode external trigger pulse output one-shot pulse output mode one-shot pulse output pwm output mode pwm output square wave output free-running timer mode square wave output (only when compare function is used) pulse width measurement mode none remark n = 0 to 8 table 7-5. truth table of topn0 and topn1 pins under control of timer output control bits tpnioc0.tpnolm bit tpnioc0.tpnoem bit tpnctl0.tpnce bit level of topnm pin 0 low-level output 0 low-level output 0 1 1 low level immediately before counting, high level after counting is started 0 high-level output 0 high-level output 1 1 1 high level immediately before counting, low level after counting is started remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 257 7.6 operation tmpn can perform the following operations. operation tpnctl1.tpnest bit (software trigger bit) tipn0 pin (external trigger input) capture/compare register setting compare register write interval timer mode invalid invalid compare only anytime write external event count mode note 1 invalid invalid compare only anytime write external trigger pulse output mode note 2 valid valid compare only batch write one-shot pulse output mode note 2 valid valid compare only anytime write pwm output mode invalid invalid compare only batch write free-running timer mode invalid invalid switching enabled anytime write pulse width measurement mode note 2 invalid invalid capture only not applicable notes 1. to use the external event count mode, specify that t he valid edge of the tipn0 pin capture trigger input is not detected (by clearing the tpnioc1.tpni s1 and tpnioc1.tpnis0 bits to ?00?). 2. to use the external trigger pulse output mode, one- shot pulse output mode, or pulse width measurement mode, select the internal clock (by setting the tpnctl1.tpneee bit to 0) as the count clock. remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 258 (1) counter basic operation this section explains the basic oper ation of the 16-bit counter. for details, refer to the description of the operation in each mode. remark n = 0 to 8 (a) counter start operation the 16-bit counter of tmpn starts countin g from the default value ffffh in all modes. it counts up from ffffh to 0000h, 0001h, 0002h, 0003h, and so on. (b) clear operation the 16-bit counter is cleared to 0000h when its value matches the value of the compare register and is cleared, and when its value is captured and cleared. the counting operation fr om ffffh to 0000h that takes place immediately after the counter has start ed counting or when the counter overflows is not a clearing operation. therefore, the inttpncc0 and inttpncc1 interrupt signals are not generated. (c) overflow operation the 16-bit counter overflows when the counter counts up from ffffh to 0000h in the free-running timer mode or pulse width measurement mode . if the counter overflows, the tpnopt0.tpnovf bit is set to 1 and an interrupt request signal (inttpnov) is generate d. note that the inttpnov signal is not generated under the following conditions. ? immediately after a counti ng operation has been started ? if the counter value matches the compare value ffffh and is cleared ? when ffffh is captured and cleared in the pulse width measurement mode and the counter counts up from ffffh to 0000h caution after the overflow interrupt request signa l (inttpnov) has been generated, be sure to check that the overflow flag (tpnovf bit) is set to 1. (d) counter read operation during counting operation the value of the 16-bit counter of tmpn can be re ad by using the tpncnt register during the count operation. when the tpnctl0.tpnce bit = 1, the val ue of the 16-bit counter can be read by reading the tpncnt register. when the tpnctl0.tpnce bit = 0, the 16-bit counter is ffffh and the tpncnt register is 0000h. (e) interrupt operation tmpn generates the following three types of interrupt request signals. ? inttpncc0 interrupt: this signal functions as a match interrupt request signal of the ccr0 buffer register and as a capture interrupt request signal to the tpnccr0 register. ? inttpncc1 interrupt: this signal functions as a match interrupt request signal of the ccr1 buffer register and as a capture interrupt request signal to the tpnccr1 register. ? inttpnov interrupt: this signal functions as an overflow interrupt request signal.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 259 (2) anytime write and batch write the tpnccr0 and tpnccr1 registers in tmpn can be re written during timer operation (tpnctl0.tpnce bit = 1), but the write method (anytime write, batch wr ite) of the ccr0 and ccr1 buffer registers differs depending on the mode. (a) anytime write in this mode, data is transferred at any time from the tpnccr0 and tpnccr1 registers to the ccr0 and ccr1 buffer registers during timer operation. (n = 0 to 8). figure 7-2. flowchart of basic operation for anytime write start initial settings ? set values to tpnccrm register ? timer operation enable (tpnce bit = 1) transfer values of tpnccrm register to ccrm buffer register timer operation ? match between 16-bit counter and ccr1 buffer register note ? match between 16-bit counter and ccr0 buffer register ? 16-bit counter clear & start inttpncc1 signal output tpnccrm register rewrite transfer to ccrm buffer register inttpncc0 signal output note the 16-bit counter is not cleared upon a match bet ween the 16-bit counter value and the ccr1 buffer register value. it is cleared upon a match between t he 16-bit counter value and the ccr0 buffer register value. remarks 1. the above flowchart illustrates an example of the operation in the interval timer mode. 2. n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 260 figure 7-3. timing of anytime write d 01 d 01 d 01 d 01 0000h tpnce bit = 1 d 02 d 02 d 11 d 11 d 11 d 12 d 12 d 12 d 02 d 11 0000h d 12 16-bit counter tpnccr0 register tpnccr1 register inttpncc0 signal inttpncc1 signal ccr0 buffer register ccr1 buffer register 0000h ffffh remarks 1. d 01 , d 02 : setting values of tpnccr0 register d 11 , d 12 : setting values of tpnccr1 register 2. the above timing chart illustrates an example of the operation in the interval timer mode. 3. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 261 (b) batch write in this mode, data is transferred all at once from the tpnccr0 and tpnccr1 registers to the ccr0 and ccr1 buffer registers during timer operation. this data is transferred upon a match between the value of the ccr0 buffer register and the value of the 16-bit counter. transfer is enabled by writing to the tpnccr1 register. whether to enable or disable the next transfer timing is controlled by writing or not writing to the tpnccr1 register. in order for the setting value when the tpnccr0 and tpnccr1 registers are rewritten to become the 16- bit counter comparison value (in other words, in or der for this value to be transferred to the ccr0 and ccr1 buffer registers), it is necessary to rewrite the tpnccr0 register and then write to the tpnccr1 register before the 16-bit counter value and the ccr0 buff er register value match. therefore, the values of the tpnccr0 and tpnccr1 registers are transferr ed to the ccr0 and ccr1 buffer registers upon a match between the count value of the 16-bit counter and the value of the ccr0 buffer register. thus even when wishing only to rewrite the value of the tpnccr 0 register, also write the same value (same as preset value of the tpnccr1 regi ster) to the tpnccr1 register.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 262 figure 7-4. flowchart of basic operation for batch write start initial settings ? set values to tpnccrm register ? timer operation enable (tpnce bit = 1) transfer values of tpnccrm register to ccrm buffer register timer operation ? match between 16-bit counter and ccr1 buffer register note ? match between 16-bit counter and ccr0 buffer register ? 16-bit counter clear & start ? transfer of values of tpnccrm register to ccrm buffer register inttpncc1 signal output tpnccr0 register rewrite tpnccr1 register rewrite inttpncc0 signal output batch write enable note the 16-bit counter is not cleared upon a match bet ween the 16-bit counter value and the ccr1 buffer register value. it is cleared upon a match between t he 16-bit counter value and the ccr0 buffer register value. caution writing to the tpnccr1 regi ster includes enabling of batch wr ite. thus, rewrite the tpnccr1 register after rewriting the tpnccr0 register. remarks 1. the above flowchart illustrates an example of the operation in the pwm output mode. 2. n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 263 figure 7-5. timing of batch write d 01 d 01 d 02 d 03 0000h d 01 d 11 d 12 d 12 0000h d 11 tpnce bit = 1 note 1 d 02 d 02 d 03 d 11 d 12 d 12 d 12 d 12 16-bit counter tpnccr0 register tpnccr1 register inttpncc0 signal inttpncc1 signal topn1 pin output topn0 pin output ccr0 buffer register ccr1 buffer register note 1 note 1 note 1 same value write d 02 d 12 0000h d 03 d 12 note 2 note 3 ffffh notes 1. because the tpnccr1 register was not rewritten, d 03 is not transferred. 2. because the tpnccr1 register has been written (d 12 ), data is transferred to the ccr1 buffer register upon a match between the value of t he 16-bit counter and the value of the tpnccr0 register (d 01 ). 3. because the tpnccr1 register has been written (d 12 ), data is transferred to the ccr1 buffer register upon a match between the value of t he 16-bit counter and the value of the tpnccr0 register (d 02 ). remarks 1. d 01 , d 02 , d 03 : setting values of tpnccr0 register d 11 , d 12 : setting values of tpnccr1 register 2. the above timing chart illustrates the opera tion in the pwm output mode as an example. 3. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 264 7.6.1 interval timer mode (t pnmd2 to tpnmd0 bits = 000) in the interval timer mode, an interrupt request signal (inttpncc0) is generated at the interval set by the tpnccr0 register if the tpnctl0.tpnce bit is set to 1. a square wave with a duty factor of 50% whose half cycle is equal to the interval can be output from the topn0 pin. the tpnccr1 register is not used in the interval timer m ode. however, the set value of the tpnccr1 register is transferred to the ccr1 buffer register, and when the count va lue of the 16-bit counter ma tches the value of the ccr1 buffer register, a compare match interrupt request signal (i nttpncc1) is generated. in addition, a square wave with a duty factor of 50%, which is inverted when the inttpncc1 signal is generated, can be ou tput from the topn1 pin. the value of the tpnccr0 and tpnccr1 registers c an be rewritten even while the timer is operating. figure 7-6. configuration of interval timer 16-bit counter output controller ccr0 buffer register tpnce bit tpnccr0 register count clock selection clear match signal topn0 pin inttpncc0 signal remark n = 0 to 8 figure 7-7. basic timing of operation in interval timer mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register topn0 pin output inttpncc0 signal d 0 d 0 d 0 d 0 d 0 interval (d 0 + 1) interval (d 0 + 1) interval (d 0 + 1) interval (d 0 + 1) remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 265 when the tpnce bit is set to 1, the va lue of the 16-bit counter is cleared fr om ffffh to 0000h in synchronization with the count clock, and t he counter starts counting. at this time, the out put of the topn0 pin is inverted. additionally, the set value of the tpnccr0 register is transferred to the ccr0 buffer register. when the count value of the 16-bit counter matches the valu e of the ccr0 buffer regi ster, the 16-bit counter is cleared to 0000h, the output of the topn0 pin is in verted, and a compare match interrupt request signal (inttpncc0) is generated. the interval can be calculated by the following expression. interval = (set value of tpnccr0 register + 1) count clock cycle remark n = 0 to 8 figure 7-8. register setting for in terval timer mode operation (1/3) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 select count clock 0: stop counting 1: enable counting 0/1 0/1 0/1 tpncks2 tpncks1 tpncks0 tpnce (b) tmpn control register 1 (tpnctl1) 0 0 0/1 note 00 tpnctl1 0, 0, 0: interval timer mode 0: operate on count clock selected by tpncks0 to tpncks2 bits 1: count with external event count input signal 000 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest note the tpneee bit can be set to 1 only when the timer output (topn1) is used. however, set the tpnccr0 and tpnccr1 registers to the same value.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 266 figure 7-8. register setting for in terval timer mode operation (2/3) (c) tmpn i/o control register 0 (tpnioc0) 0 0 0 0 0/1 tpnioc0 0: disable topn0 pin output 1: enable topn0 pin output setting to output level of topn0 pin before count operation 0: low level 1: high level 0: disable topn1 pin output 1: enable topn1 pin output setting to output level of topn1 pin before count operation 0: low level 1: high level 0/1 0/1 0/1 tpnoe1 tpnol0 tpnoe0 tpnol1 (d) tmpn i/o control register 2 (tpnioc2) 0 0 0 0 0/1 note tpnioc2 select valid edge of external event count input (tipn0 pin). 0/1 note 00 tpnees0 tpnets1 tpnets0 tpnees1 note the tpnees1 and tpnees0 bits can be set only when the timer output (topn1) is used. however, set the tpnccr0 and tpnccr1 registers to the same value. (e) tmpn counter read bu ffer register (tpncnt) by reading the tpncnt register, the count va lue of the 16-bit counter can be read. (f) tmpn capture/compare register 0 (tpnccr0) if the tpnccr0 register is set to d 0 , the interval is as follows. interval = (d 0 + 1) count clock cycle remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 267 figure 7-8. register setting for in terval timer mode operation (3/3) (g) tmpn capture/compare register 1 (tpnccr1) the tpnccr1 register is not used in the interval timer mode. however, the set value of the tpnccr1 register is transferred to the ccr1 buffer register. when the count value of the 16-bit counter matches the value of the ccr1 buffer regi ster, the topn1 pin output is inverted and a compare match interrupt request signal (inttpncc1) is generated. by setting this register to the same value as the va lue set in the tpnccr0 register, a square wave with a duty factor of 50% can be output from the topn1 pin. when the tpnccr1 register is not used, it is recommended to set its value to ffffh. also mask the register by the interrupt mask flag (tpnccic1.tpnccmk1). remarks 1. tmpn i/o control register 1 (tpnioc1) and tmpn option register 0 (tpnopt0) are not used in the interval timer mode. 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 268 (1) interval timer mode operation flow figure 7-9. software processing flow in interval timer mode tpnce bit = 1 tpnce bit = 0 register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc0 register, tpnioc2 register note , tpnccr0 register initial setting of these registers is performed before setting the tpnce bit to 1. the tpncks0 to tpncks2 bits can be set at the same time when counting has been started (tpnce bit = 1). the counter is initialized and counting is stopped by clearing the tpnce bit to 0. the output level of the topn0 pin is as specified by the tpnioc0 register. start stop <1> count operation start flow <2> count operation stop flow d 0 <1> <2> d 0 d 0 d 0 ffffh 16-bit counter 0000h tpnce bit tpnccr0 register topn0 pin output inttpncc0 signal note the tpnees1 and tpnees0 bits can be set only when timer output (topn1) is used. however, set the tpnccr0 and tpnccr1 registers to the same value. remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 269 (2) interval timer mode operation timing (a) operation if tpnccr0 re gister is set to 0000h if the tpnccr0 register is set to 0000h, the inttpn cc0 signal is generated at each count clock, and the output of the topn0 pin is inverted. the value of the 16-bit counter is always 0000h. count clock 16-bit counter tpnce bit tpnccr0 register topn0 pin output inttpncc0 signal 0000h interval time count clock cycle interval time count clock cycle interval time count clock cycle ffffh 0000h 0000h 0000h 0000h remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 270 (b) operation if tpnccr0 register is set to ffffh if the tpnccr0 register is set to ffffh, the 16-bit co unter counts up to ffffh. t he counter is cleared to 0000h in synchronization with the next count-up timing. the inttpncc0 signal is generated and the output of the topn0 pin is inverted. at this time, an overflow interrupt request signal (inttpnov) is not generated, nor is the overflow flag (tpnopt0.tpnovf bit) set to 1. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register topn0 pin output inttpncc0 signal ffffh interval time 10000h count clock cycle interval time 10000h count clock cycle interval time 10000h count clock cycle remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 271 (c) notes on rewriting tpnccr0 register when the value of the tpnccr0 register is rewritten to a smaller value during counting, the 16-bit counter may overflow. if there is a possibility of ov erflow, stop counting and then change the set value. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register tpnol0 bit topn0 pin output inttpncc0 signal d 1 d 2 d 1 d 1 d 2 d 2 d 2 l interval time (1) interval time (ng) interval time (2) remarks 1. interval time (1): (d 1 + 1) count clock cycle interval time (ng): (10000h + d 2 + 1) count clock cycle interval time (2): (d 2 + 1) count clock cycle 2. n = 0 to 8 if the value of the tpnccr0 register is changed from d 1 to d 2 while the count value is greater than d 2 but less than d 1 , the count value is transferred to the ccr0 buff er register as soon as the tpnccr0 register has been rewritten. consequently, the value of the 16-bit counter that is compared is d 2 . because the count value has already exceeded d 2 , however, the 16-bit c ounter counts up to ffffh, overflows, and then counts up again from 0000h. when the count value matches d 2 , the inttpncc0 signal is generated and the output of the topn0 pin is inverted. therefore, the inttpncc0 signal may not be generated at the interval time ?(d 1 + 1) count clock cycle? or ?(d 2 + 1) count clock cycle? originally expected, but may be generated at an interval of ?(10000h + d 2 + 1) count clock period?.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 272 (d) operation of tpnccr1 register figure 7-10. configuration of tpnccr1 register ccr0 buffer register tpnccr0 register tpnccr1 register ccr1 buffer register topn0 pin inttpncc0 signal topn1 pin inttpncc1 signal 16-bit counter output controller tpnce bit count clock selection clear match signal output controller match signal remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 273 when the tpnccr1 register is set to the same val ue as the tpnccr0 register, the inttpncc1 signal is generated at the same timing as the inttpncc0 signa l and the topn1 pin output is inverted. in other words, a square wave with a duty factor of 50% can be output from the topn1 pin. the following shows the operation when the tpnccr1 re gister is set to other than the value set in the tpnccr0 register. if the set value of the tpnccr1 register is less than the set value of the tpnccr0 register, the inttpncc1 signal is generated once per cycle. at the same time, the output of the topn1 pin is inverted. the topn1 pin outputs a square wave with a duty fact or of 50% after outputting a short-width pulse. figure 7-11. timing chart when d 01 d 11 ffffh 16-bit counter 0000h tpnce bit tpnccr0 register topn0 pin output inttpncc0 signal tpnccr1 register topn1 pin output inttpncc1 signal d 01 d 11 d 01 d 11 d 11 d 11 d 11 d 01 d 01 d 01 remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 274 if the set value of the tpnccr1 register is greater than the set value of the tpnccr0 register, the count value of the 16-bit counter does not match the va lue of the tpnccr1 register. consequently, the inttpncc1 signal is not generated, nor is the output of the topn1 pin changed. when the tpnccr1 register is not used, it is recommended to set it s value to ffffh. figure 7-12. timing chart when d 01 < d 11 ffffh 16-bit counter 0000h tpnce bit tpnccr0 register topn0 pin output inttpncc0 signal tpnccr1 register topn1 pin output inttpncc1 signal d 01 d 11 d 01 d 01 d 01 d 01 l remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 275 (3) operation by external event count input (tipn0) (a) operation to count the 16-bit counter at the va lid edge of external event count input (tipn0) in the interval timer mode, the valid edge of the external event count input is necessary once because the 16-bit counter is cleared from ffffh to 0000h immediately afte r the tpnce bit is set from 0 to 1. when 0001h is set to both the tpnccr0 and tpnccr1 r egisters, the topn1 pin output is inverted each time the 16-bit counter counts twice. the tpnctl1.tpneee bit can be set to 1 in the interval timer mode only when the timer output (topn1) is used with the external event count input. tpnce bit external event count input tpnccr0 register tpnccr1 register topn1 pin output 16-bit counter ffffh 0000h 0001h 0001h 0001h 0001h 0001h 0001h 0001h 0001h 0001h number of external events: 3 number of external events: 2 number of external events: 2 2-count width 2-count width 2-count width (tipn0 pin input) remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 276 7.6.2 external event count mode (tpnmd2 to tpnmd0 bits = 001) in the external event count mode, the valid edge of the external event count input (tipn0) is counted when the tpnctl0.tpnce bit is set to 1, and an interrupt request signal (inttpncc0) is generated each time the number of edges set by the tpnccr0 register have been counted. the topn0 and topn1 pins cannot be used. when using the topn1 pin for external event count input, set the tp nctl1.tpneee bit to 1 in the interval timer mode (see 7.6.1 (3) operation by external event count input (tipn0) ). the tpnccr1 register is not used in the external event count mode. caution in the external event count mode, the tpnccr0 and tpnccr1 registers must not be cleared to 0000h. figure 7-13. configuration in external event count mode 16-bit counter ccr0 buffer register tpnce bit tpnccr0 register edge detector clear match signal inttpncc0 signal tipn0 pin (external event count input) remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 277 figure 7-14. basic timing in external event count mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal d 0 d 0 d 0 d 0 16-bit counter tpnccr0 register inttpncc0 signal external event count input (tipn0 pin input) d 0 number of external event count (d 0 ) note times number of external event count (d 0 + 1) times number of external event count (d 0 + 1) times d 0 ? 1d 0 0000 0001 note in the external event count mode, when the tpnct l0.tpnce bit is set to 1 (operation starts), the 16-bit counter is cleared from ffffh to 0000h at the same time. the first count operation starts from 0001h each time the valid edge of the external event count input is detected. therefore, the count of the fi rst count operation is one number smaller than the count of the second or subsequent count operation. remarks 1. this figure shows the basic timing when the ri sing edge is specified as the valid edge of the external event count input. 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 278 when the tpnce bit is set to 1, the value of the 16-bit counter is clea red from ffffh to 0000h. the counter counts each time the valid edge of external event count input is detected. additionally, the set value of the tpnccr0 register is transferred to the ccr0 buffer register. when the count value of the 16-bit counter matches the valu e of the ccr0 buffer regi ster, the 16-bit counter is cleared to 0000h, and a compare match interrupt request signal (inttpncc0) is generated. the inttpncc0 signal is generated for the first time wh en the valid edge of the exte rnal event count input has been detected ?value set to tpnccr0 register? times. after that, the inttpncc0 signal is generated each time the valid edge of the external event count input has been det ected ?value set to tpnccr0 register + 1? times. figure 7-15. register setting for operati on in external event count mode (1/2) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 0: stop counting 1: enable counting 000 tpncks2 tpncks1 tpncks0 tpnce (b) tmpn control register 1 (tpnctl1) 00000 tpnctl1 0, 0, 1: external event count mode 001 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest (c) tmpn i/o control register 2 (tpnioc2) 0 0 0 0 0/1 tpnioc2 select valid edge of external event count input (tipn0 pin) 0/1 0 0 tpnees0 tpnets1 tpnets0 tpnees1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 279 figure 7-15. register setting for operati on in external event count mode (2/2) (d) tmpn counter read bu ffer register (tpncnt) the count value of the 16-bit counter can be read by reading the tpncnt register. (e) tmpn capture/compare register 0 (tpnccr0) if the tpnccr0 register is set to d 0 , the count is cleared when the number of external events has reached (d 0 ) and the first compare match interrupt request signal (inttpncc0) is generated. the second compare match interrupt request signal (inttpncc0) is generated when the number of external events has reached (d 0 + 1). (f) tmpn capture/compare register 1 (tpnccr1) the tpnccr1 register is not used in the external event count mode. however, the set value of the tpnccr1 register is transferred to the ccr1 buff er register. when the c ount value of the 16-bit counter matches the value of the ccr1 buffer regi ster, a compare match interrupt request signal (inttpncc1) is generated. when the tpnccr1 registers are not used, it is recommended to set their value to ffffh. also mask the register by the interrupt mask flag (tpnccic1.tpnccmk1). cautions 1. set 00h to the tpnioc0 register. 2. when the external clock is used as the count clock, the external clock can be input only from the tipn0 pin. at this time, cl ear the tpnioc1.tpnis1 and tpnis0 bits to 00 (capture trigger input (tipn0 pin): no edge detected). remarks 1. tmpn i/o control register 1 (tpnioc1) and tmpn option register 0 (tpnopt0) are not used in the external event count mode. 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 280 (1) external event count mode operation flow figure 7-16. flow of software processing in external event count mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal d 0 d 0 d 0 d 0 <1> <2> tpnce bit = 1 tpnce bit = 0 register initial setting tpnctl1 register, tpnioc2 register, tpnccr0, tpnccr1 registers initial setting of these registers is performed before the tpnce bit is set to 1. the counter is initialized and counting is stopped by clearing the tpnce bit to 0. start stop <1> count operation start flow <2> count operation stop flow remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 281 (2) operation timing in external event count mode cautions 1. in the external event count mode, do not set the tpnccr0 and tpnccr1 registers to 0000h. 2. in the external event count mode, use of th e timer output (topn0, topn1) is disabled. if performing timer output (topn1) using external event count input (tipn0), set the interval timer mode, and set the operation enabled (tpnctl1.tpneee bit = 1) by the external event count input for the count clock (refer to 7.6.1 (3) operation by external event count input (tipn0)). (a) operation if tpnccr0 register is set to ffffh if the tpnccr0 register is set to ffffh, the 16-bit co unter counts to ffffh each time the valid edge of the external event count signal has been detected. the 16-bit counter is cleared to 0000h in synchronization with the next count-up timing, and the inttpncc0 signal is generated. at this time, the tpnopt0.tpnovf bit is not set. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal ffffh number of external event count ffffh times number of external event count 10000h times number of external event count 10000h times remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 282 (b) notes on rewriting the tpnccr0 register when the value of the tpnccr0 register is rewritten to a smaller value during counting, the 16-bit counter may overflow. if there is a possibility of ov erflow, stop counting and then change the set value. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal d 1 d 2 d 1 d 1 d 2 d 2 d 2 number of external event count (1) (d 1 ) times number of external event count (ng) (10000h + d 2 + 1) times number of external event count (2) (d 2 + 1) times remark n = 0 to 8 if the value of the tpnccr0 register is changed from d 1 to d 2 while the count value is greater than d 2 but less than d 1 , the count value is transferred to the ccr0 buff er register as soon as the tpnccr0 register has been rewritten. consequently, the value t hat is compared with the 16-bit counter is d 2 . because the count value has already exceeded d 2 , however, the 16-bit c ounter counts up to ffffh, overflows, and then counts up again from 0000h. when the count value matches d 2 , the inttpncc0 signal is generated. therefore, the inttpncc0 signal may not be generated at the va lid edge count of ?(d 1 + 1) times? or ?(d 2 + 1) times? originally expected, but may be generated at the valid edge count of ?(10000h + d 2 + 1) times?.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 283 (c) operation of tpnccr1 register figure 7-17. configuration of tpnccr1 register ccr0 buffer register tpnce bit tpnccr0 register 16-bit counter tpnccr1 register ccr1 buffer register clear match signal match signal inttpncc0 signal inttpncc1 signal edge detector tipn0 pin (external event count input) remark n = 0 to 8 if the set value of the tpnccr1 register is smalle r than the set value of the tpnccr0 register, the inttpncc1 signal is generated once per cycle. figure 7-18. timing chart when d 01 d 11 ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal tpnccr1 register inttpncc1 signal d 01 d 11 d 01 d 11 d 11 d 11 d 11 d 01 d 01 d 01 remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 284 if the set value of the tpnccr1 register is greater than the set value of the tpnccr0 register, the inttpncc1 signal is not generated because the count va lue of the 16-bit counte r and the value of the tpnccr1 register do not match. it is recommended to set ffffh to the tpnccr1 register when the tpnccr1 register is not used. figure 7-19. timing chart when d 01 < d 11 ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal tpnccr1 register inttpncc1 signal d 01 d 11 d 01 d 01 d 01 d 01 l remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 285 7.6.3 external trigger pulse output m ode (tpnmd2 to tpnmd0 bits = 010) in the external trigger pulse output mode, 16-bit timer/event counter p waits for a trigger when the tpnctl0.tpnce bit is set to 1. when the valid edge of an external trigger input (tipn0) is detected, 16-bit timer/event counter p starts counting, and ou tputs a pwm waveform from the topn1 pin. pulses can also be output by generating a software trigger instead of using the external trigger. when using a software trigger, a square wave with a duty factor of 50% that has the set value of the tpnccr0 register + 1 as half its cycle can also be output from the topn0 pin. figure 7-20. configuration in external trigger pulse output mode ccr0 buffer register tpnce bit tpnccr0 register 16-bit counter tpnccr1 register ccr1 buffer register clear match signal match signal inttpncc0 signal output controller (rs-ff) output controller topn1 pin inttpncc1 signal topn0 pin note count clock selection count start control edge detector software trigger generation tipn0 pin note (external trigger input) transfer transfer s r note because the external trigger input pin (tipn0) and timer output pin (topn0) share the same alternate- function pin, two functions cannot be used at the same time. caution in external trigger pulse output mode, select the internal clock (set tpnctl1.tpneee bit = 0) as the count clock. remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 286 figure 7-21. basic timing in exte rnal trigger pulse output mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal tpnccr1 register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) topn0 pin output (only when software trigger is used) d 1 d 0 d 0 d 1 d 1 d 1 d 1 d 0 d 0 d 0 wait for trigger active level width (d 1 ) cycle (d 0 + 1) cycle (d 0 + 1) cycle (d 0 + 1) active level width (d 1 ) active level width (d 1 ) 16-bit timer/event counter p waits for a trigger when the tpnc e bit is set to 1. when the trigger is generated, the 16-bit counter is cleared from ffffh to 0000h, starts counti ng at the same time, and outputs a pwm wave\form from the topn1 pin. if the trigger is generated again while the counter is operating, the counter is cleared to 0000h and restarted. (the output of th e topn0 pin is inverted. the topn1 pin ou tputs a high-level regardless of the status (high/low) when a trigger occurs.) the active level width, cycle, and duty factor of the pwm waveform can be calculated as follows. active level width = (set value of tpnccr1 register) count clock cycle cycle = (set value of tpnccr0 register + 1) count clock cycle duty factor = (set value of tpnccr1 regist er)/(set value of tpnccr0 register + 1) the compare match request signal inttpncc0 is generat ed when the 16-bit counter counts next time after its count value matches the value of the c cr0 buffer register, and the 16-bit count er is cleared to 0000h. the compare match interrupt request signal inttpncc1 is generated when t he count value of the 16-bit counter matches the value of the ccr1 buffer register. the value set to the tpnccrm register is transferred to the ccrm buffer register when the count value of the 16- bit counter matches the value of the ccrm buffer re gister and the 16-bit counter is cleared to 0000h. the valid edge of an external trigger input (tipn0) signal, or setting the software trigger (tpnctl1.tpnest bit) to 1 is used as the trigger. remark n = 0 to 8, m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 287 figure 7-22. setting of registers in exte rnal trigger pulse output mode (1/2) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 select count clock 0: stop counting 1: enable counting 0/1 0/1 0/1 tpncks2 tpncks1 tpncks0 tpnce (b) tmpn control register 1 (tpnctl1) 0 0/1 0 0 0 tpnctl1 0: operate on count clock selected by tpncks0 to tpncks2 bits generate software trigger when 1 is written 010 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest 0, 1, 0: external trigger pulse output mode (c) tmpn i/o control register 0 (tpnioc0) 0 0 0 0 0/1 tpnioc0 0: disable topn0 pin output 1: enable topn0 pin output setting level of topn1 pin in status of waiting for external trigger 0: low level 1: high level 0: disable topn1 pin output 1: enable topn1 pin output setting level of topn1 pin in status of waiting for external trigger 0: low level 1: high level 0/1 0/1 0/1 note tpnoe1 tpnol0 tpnoe0 tpnol1 topn1 pin output 16-bit counter ? when tpnol1 bit = 0 topn1 pin output 16-bit counter ? when tpnol1 bit = 1 note clear this bit to 0 when the topn0 pin is not us ed in the external trigger pulse output mode.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 288 figure 7-22. setting of registers in exte rnal trigger pulse output mode (2/2) (d) tmpn i/o control register 2 (tpnioc2) 00000 tpnioc2 select valid edge of external trigger input (tipn0 pin) 0 0/1 0/1 tpnees0 tpnets1 tpnets0 tpnees1 (e) tmpn counter read bu ffer register (tpncnt) the value of the 16-bit counter can be read by reading the tpncnt register. (f) tmpn capture/compare register s 0 and 1 (tpnccr0 and tpnccr1) if d 0 is set to the tpnccr0 register and d 1 to the tpnccr1 register, the cycle and active level of the pwm waveform are as follows. cycle = (d 0 + 1) count clock cycle active level width = d 1 count clock cycle remarks 1. tmpn i/o control register 1 (tpnioc1) and tmpn option register 0 (tpnopt0) are not used in the external trigger pulse output mode. 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 289 (1) operation flow in extern al trigger pulse output mode figure 7-23. software processing flow in ex ternal trigger pulse output mode (1/2) ffffh 16-bit counter 0000h tpnce bit tpnccr0 register ccr0 buffer register inttpncc0 signal tpnccr1 register ccr1 buffer register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) topn0 pin output (only when software trigger is used) d 10 d 00 d 00 d 01 d 00 d 00 d 10 d 10 d 11 d 10 d 10 d 10 d 11 d 10 d 01 d 00 d 10 d 10 d 00 d 10 d 00 d 11 d 11 d 01 d 01 d 01 <1> <2> <3> <4> <5> remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 290 figure 7-23. software processing flow in ex ternal trigger pulse output mode (2/2) tpnce bit = 1 setting of tpnccr0 register register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc0 register, tpnioc2 register, tpnccr0 register, tpnccr1 register initial setting of these registers is performed before setting the tpnce bit to 1. the tpncks0 to tpncks2 bits can be set at the same time when counting is enabled (tpnce bit = 1). trigger wait status writing the same value (same as the tpnccr1 register already set) to the tpnccr1 register is necessary only when the set cycle is changed. when the counter is cleared after setting, the value of the tpnccrm register is transferred to the ccrm buffer register. start setting of tpnccr1 register <1> count operation start flow <2> tpnccr0 and tpnccr1 register setting change flow setting of tpnccr0 register when the counter is cleared after setting, the value of the tpnccrm register is transferred to the ccrm buffer register. setting of tpnccr1 register <4> pnccr0, tpnccr1 register setting change flow only writing of the tpnccr1 register must be performed when the set duty factor is changed. when the counter is cleared after setting, the value of the tpnccrm register is transferred to the ccrm buffer register. setting of tpnccr1 register <3> pnccr0, tpnccr1 register setting change flow tpnce bit = 0 counting is stopped. stop <5> count operation stop flow remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 291 (2) external trigger pulse output mode operation timing (a) note on changing pulse width during operation to change the pwm waveform while the counter is operating, write the tpnccr1 register last. rewrite the tpnccrm register after writing the tpnccr 1 register after the inttpncc0 signal is detected. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register ccr0 buffer register inttpncc0 signal tpnccr1 register ccr1 buffer register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) topn0 pin output (only when software trigger is used) d 10 d 00 d 00 d 01 d 00 d 10 d 11 d 10 d 11 d 01 d 10 d 10 d 00 d 00 d 11 d 11 d 01 d 01 remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 292 in order to transfer data from the tpnccrm register to the ccrm buffer register, the tpnccr1 register must be written. to change both the cycle and active level width of the pwm waveform at this time, first set the cycle to the tpnccr0 register and then set the active level width to the tpnccr1 register. to change only the cycle of the pwm waveform, first set the cycle to the tpnccr0 register, and then write the same value (same as the tpnccr1 regist er already set) to the tpnccr1 register. to change only the active level width (duty factor) of the pwm waveform, only the tpnccr1 register has to be set. after data is written to the tpnccr1 register, the val ue written to the tpnccrm register is transferred to the ccrm buffer register in synchronization with clear ing of the 16-bit counter, and is used as the value compared with the 16-bit counter. to write the tpnccr0 or tpnccr1 register again after writing the tpnccr1 register once, do so after the inttpncc0 signal is generated. otherwise, the value of the ccrm buffer register may become undefined because the timing of transferring data from the tpn ccrm register to the ccrm buffer register conflicts with writing the tpnccrm register. remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 293 (b) 0%/100% output of pwm waveform to output a 0% waveform, set the tpnccr1 register to 0000h. the 16-bit counter is cleared to 0000h and the inttpnco0 and inttpncc1 signals are generated at the next timing after a match between the count value of the 16-bit counter and t he value of the ccr0 buffer register. count clock 16-bit counter tpnce bit tpnccr0 register tpnccr1 register inttpncc0 signal inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) d 0 l 0000h d 0 0000h d 0 0000h d 0 ? 1d 0 0000 ffff 0000 d 0 ? 1d 0 0000 0001 remark n = 0 to 8 to output a 100% waveform, set a value of (set value of tpnccr0 register + 1) to the tpnccr1 register. if the set value of the tpnccr0 register is ffffh, 100% output cannot be produced. d 0 d 0 + 1 d 0 d 0 + 1 d 0 d 0 + 1 d 0 0000 ffff 0000 d 0 0000 0001 count clock 16-bit counter tpnce bit tpnccr0 register tpnccr1 register inttpncc0 signal inttpncc1 signal topn1 pin output d 0 ? 1d 0 ? 1 external trigger input (tipn0 pin input) remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 294 (c) conflict between trigger detection and match with ccr1 buffer register if the trigger is detected immediately after the inttp ncc1 signal is generated, the 16-bit counter is immediately cleared to 0000h, the output signal of the topn1 pin is asserted, and the counter continues counting. consequently, the inactive peri od of the pwm waveform is shortened. 16-bit counter ccr1 buffer register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) d 1 d 1 ? 1 0000 ffff 0000 shortened remark n = 0 to 8 if the trigger is detected immediately before the inttp ncc1 signal is generated, the inttpncc1 signal is not generated, and the 16-bit counter is cleared to 0000h and continues counting. t he output signal of the topn1 pin remains active. consequently, the active period of the pwm waveform is extended. 16-bit counter ccr1 buffer register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) d 1 d 1 ? 2d 1 ? 1d 1 0000 ffff 0000 0001 extended remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 295 (d) conflict between trigger detection and match with ccr0 buffer register if the trigger is detected immediately after the inttp ncc0 signal is generated, the 16-bit counter is cleared to 0000h and continues counting up. therefore, the active period of the topn1 pin is extended by time from generation of the inttpncc0 signal to trigger detection. 16-bit counter ccr0 buffer register inttpncc0 signal topn1 pin output external trigger input (tipn0 pin input) d 0 d 0 ? 1d 0 0000 ffff 0000 0000 extended remark n = 0 to 8 if the trigger is detected immediately before the inttp ncc0 signal is generated, the inttpncc0 signal is not generated. the 16-bit counter is cleared to 0000h, the topn1 pin is asserted, and the counter continues counting. consequently, the inactive period of the pwm waveform is shortened. 16-bit counter ccr0 buffer register inttpncc0 signal topn1 pin output external trigger input (tipn0 pin input) d 0 d 0 ? 1d 0 0000 ffff 0000 0001 shortened remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 296 (e) generation timing of compare match interrupt request signal (inttpncc1) the timing of generation of the inttpncc1 signal in the external trigger pulse output mode differs from the timing of other mode inttpncc1 signals; the in ttpncc1 signal is generated when the count value of the 16-bit counter matches the value of the tpnccr1 register. count clock 16-bit counter tpnccr1 register topn1 pin output inttpncc1 signal d 1 d 1 ? 1d 1 ? 1d 1 d 1 + 1 d 1 + 2 remark n = 0 to 8 usually, the inttpncc1 signal is generated in synch ronization with the next count up, after the count value of the 16-bit counter matches the value of the tpnccr1 register. in the external trigger pulse output mode, however, it is generated one clock earlier. this is because the timing is changed to match the timing of cha nging the output signal of the topn1 pin.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 297 7.6.4 one-shot pulse output mode (tpnmd2 to tpnmd0 bits = 011) in the one-shot pulse output mode, 16-bit timer/event coun ter p waits for a trigger when the tpnctl0.tpnce bit is set to 1. when the valid edge of an external trigger inpu t (tipn0) is detected, 16-bit timer/event counter p starts counting, and outputs a one-shot pulse from the topn1 pin. instead of the external trigger input (tipn0), a software tr igger can also be generated to output the pulse. when the software trigger is used, the topn0 pin outputs the acti ve level while the 16-bit counter is counting, and the inactive level when the counter is stopped (waiting for a trigger). figure 7-24. configuration in one-shot pulse output mode ccr0 buffer register tpnce bit tpnccr0 register 16-bit counter tpnccr1 register ccr1 buffer register clear match signal match signal inttpncc0 signal output controller (rs-ff) output controller (rs-ff) topn1 pin inttpncc1 signal topn0 pin note count clock selection count start control edge detector software trigger generation tipn0 pin note (external trigger input) transfer transfer s r s r note because the external trigger input pin (tipn0) and timer output pin (topn0) share the same alternate-function pin, two functions cannot be used at the same time. caution in one-shot pulse output mode, select the internal clock (set tpnctl1.tpneee bit = 0) as the count clock. remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 298 figure 7-25. basic timing in one-shot pulse output mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal tpnccr1 register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) d 1 d 0 d 0 d 1 d 1 d 1 d 0 d 0 delay (d 1 ) active level width (d 0 ? d 1 + 1) delay (d 1 ) active level width (d 0 ? d 1 + 1) delay (d 1 ) active level width (d 0 ? d 1 + 1) topn0 pin output (only when software trigger is used) when the tpnce bit is set to 1, 16-bit timer/event counter p waits for a trigger. when the trigger is generated, the 16-bit counter is cleared from ffffh to 0000h, starts counti ng, and outputs a one-shot pul se from the topn1 pin. after the one-shot pulse is output, the 16-bit counter is set to 0000h, stops counting, and waits for a trigger. when the trigger is generated again, the 16-bit counter starts counting from 0000h. if a trigger is generated again while the one-shot pulse is being output, it is ignored. the output delay period and active level width of the one-shot pulse can be calculated as follows. output delay period = (set value of tpnccr1 register) count clock cycle active level width = (set value of tpnccr0 register ? set value of tpnccr1 register + 1) count clock cycle the compare match interrupt request signal inttpncc0 is generated when the 16-bit counter counts after its count value matches the value of the c cr0 buffer register. the compare match interrupt request signal inttpncc1 is generated when the count value of the 16-bit counter matches the va lue of the ccr1 buffer register. the valid edge of an external trigger i nput (tipn0 pin) or setting the software tr igger (tpnctl1.tpnest bit) to 1 is used as the trigger. remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 299 figure 7-26. setting of registers in one-shot pulse output mode (1/2) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 select count clock 0: stop counting 1: enable counting 0/1 0/1 0/1 tpncks2 tpncks1 tpncks0 tpnce (b) tmpn control register 1 (tpnctl1) 0 0/1 0 0 0 tpnctl1 0: operate on count clock selected by tpncks0 to tpncks2 bits generate software trigger when 1 is written 011 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest 0, 1, 1: one-shot pulse output mode (c) tmpn i/o control register 0 (tpnioc0) 0 0 0 0 0/1 tpnioc0 0: disable topn0 pin output 1: enable topn0 pin output setting of topn0 pin output level in status of waiting for external trigger 0: low level 1: high level 0: disable topn1 pin output 1: enable topn1 pin output setting of topn1 pin output level in status of waiting for external trigger 0: low level 1: high level 0/1 0/1 0/1 note tpnoe1 tpnol0 tpnoe0 tpnol1 topn1 pin output 16-bit counter ? when tpnol1 bit = 0 topn1 pin output 16-bit counter ? when tpnol1 bit = 1 note clear this bit to 0 when the topn0 pin is not used in the one-shot pulse output mode.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 300 figure 7-26. setting of registers in one-shot pulse output mode (2/2) (d) tmpn i/o control register 2 (tpnioc2) 00000 tpnioc2 select valid edge of external trigger input (tipn0 pin) 0 0/1 0/1 tpnees0 tpnets1 tpnets0 tpnees1 (e) tmpn counter read bu ffer register (tpncnt) the value of the 16-bit counter can be read by reading the tpncnt register. (f) tmpn capture/compare register s 0 and 1 (tpnccr0 and tpnccr1) if d 0 is set to the tpnccr0 register and d 1 to the tpnccr1 register, the active level width and output delay period of the one-shot pulse are as follows. active level width = (d 0 ? d 1 + 1) count clock cycle output delay period = d 1 count clock cycle caution the one-shot pulse is not output if the set value of the tpnccr1 register is greater than the set value of the tpnccr0 regist er in the one-shot pulse output mode. remarks 1. tmpn i/o control register 1 (tpnioc1) and tmpn option register 0 (tpnopt0) are not used in the one-shot pulse output mode. 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 301 (1) operation flow in one-shot pulse output mode figure 7-27. software processing flow in one-shot pulse output mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal tpnccr1 register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) <1> <3> tpnce bit = 1 register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc0 register, tpnioc2 register, tpnccr0 register, tpnccr1 register initial setting of these registers is performed before setting the tpnce bit to 1. the tpncks0 to tpncks2 bits can be set at the same time when counting has been started (tpnce bit = 1). trigger wait status start <1> count operation start flow tpnce bit = 0 count operation is stopped stop <3> count operation stop flow d 10 d 00 d 11 d 01 d 00 d 10 d 11 <2> d 01 setting of tpnccr0, tpnccr1 registers as rewriting the tpnccrm register immediately forwards to the ccrm buffer register, rewriting immediately after the generation of the inttpncc0 signal is recommended. <2> tpnccr0, tpnccr1 register setting change flow remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 302 (2) operation timing in one-shot pulse output mode (a) note on rewriti ng tpnccrm register when the value of the tpnccrm register is rewritten to a smaller value during counting, the 16-bit counter may overflow. if there is a possibility of ov erflow, stop counting and then change the set value. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal tpnccr1 register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) d 10 d 11 d 00 d 01 d 00 d 10 d 10 d 10 d 01 d 11 d 00 d 00 delay (d 10 ) active level width (d 00 ? d 10 + 1) delay (d 10 ) active level width (d 00 ? d 10 + 1) delay (10000h + d 11 ) active level width (d 01 ? d 11 + 1) topn0 pin output (only when software trigger is used) when the tpnccr0 register is rewritten from d 00 to d 01 and the tpnccr1 register from d 10 to d 11 where d 00 > d 01 and d 10 > d 11 , if the tpnccr1 register is rewritten when the count value of the 16-bit counter is greater than d 11 and less than d 10 and if the tpnccr0 register is rewritten when the count value is greater than d 01 and less than d 00 , each set value is reflected as soon as the register has been rewritten and compared with the count value. the counter count s up to ffffh and then counts up again from 0000h. when the count value matches d 11 , the counter generates the inttpncc1 signal and asserts the topn1 pin. when the count value matches d 01 , the counter generates the in ttpncc0 signal, deasserts the topn1 pin, and stops counting. therefore, the counter may output a pulse with a delay period or ac tive period different from that of the one-shot pulse that is originally expected. remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 303 (b) generation timing of compare match interrupt request signal (inttpncc1) the generation timing of the inttpncc1 signal in the one-shot pulse output mode is different from other mode inttpncc1 signals; the inttpncc1 signal is gen erated when the count val ue of the 16-bit counter matches the value of the tpnccr1 register. count clock 16-bit counter tpnccr1 register topn1 pin output inttpncc1 signal d 1 d 1 ? 2d 1 ? 1d 1 d 1 + 1 d 1 + 2 remark n = 0 to 8 usually, the inttpncc1 signal is generated when the 16- bit counter counts up next time after its count value matches the value of the tpnccr1 register. in the one-shot pulse output mode, howe ver, it is generated one clock earlier. this is because the timing is changed to match the change timing of the topn1 pin. remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 304 7.6.5 pwm output mode (tpnmd 2 to tpnmd0 bits = 100) in the pwm output mode, a pwm waveform is output from the topn1 pin when the tpnctl0.tpnce bit is set to 1. in addition, a square wave with a duty factor of 50% with th e set value of the tpnccr0 register + 1 as half its cycle is output from the topn0 pin. figure 7-28. configuration in pwm output mode ccr0 buffer register tpnce bit tpnccr0 register 16-bit counter tpnccr1 register ccr1 buffer register clear match signal match signal inttpncc0 signal output controller (rs-ff) output controller topn1 pin inttpncc1 signal topn0 pin note transfer transfer s r count clock selection internal count clock tipn0 pin note (external event count input) edge detector note because the external event count input pin (tipn0) and timer output pin (topn0) share the same alternate-function pin, two or more fu nctions cannot be used at the same time. remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 305 figure 7-29. basic timing in pwm output mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register ccr0 buffer register inttpncc0 signal topn0 pin output tpnccr1 register ccr1 buffer register inttpncc1 signal topn1 pin output d 10 d 00 d 00 d 01 d 00 d 10 d 11 d 10 d 11 d 01 d 10 d 10 d 00 d 00 d 11 d 11 d 01 d 01 active period (d 10 ) cycle (d 00 + 1) inactive period (d 00 - d 10 + 1) when the tpnce bit is set to 1, the 16-bit counter is cleared from ffffh to 0000h, starts count ing, and outputs a pwm waveform from the topn1 pin. the active level width, cycle, and duty factor of the pwm waveform can be calculated as follows. active level width = (set value of tpnccr1 register) count clock cycle cycle = (set value of tpnccr0 register + 1) count clock cycle duty factor = (set value of tpnccr1 regist er)/(set value of tpnccr0 register + 1) the pwm waveform can be changed by rewriting the tpnccrm register while the counter is operating. the newly written value is reflected when the count value of the 16-bit counter matches the value of the ccr0 buffer register and the 16-bit counter is cleared to 0000h. the compare match interrupt request signal inttpncc0 is generated when the 16-bit counter counts next time after its count value matches the value of the ccr0 buffer register, and the 16-bit counter is cleared to 0000h. the compare match interrupt request signal inttpncc1 is gener ated when the count value of the 16-bit counter matches the value of the ccr1 buffer register. the value set to the tpnccrm register is transferred to the ccrm buffer register when the count value of the 16- bit counter matches the value of the ccrm buffer re gister and the 16-bit counter is cleared to 0000h. remark n = 0 to 8, m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 306 figure 7-30. setting of registers in pwm output mode (1/2) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 select count clock note 0: stop counting 1: enable counting 0/1 0/1 0/1 tpncks2 tpncks1 tpncks0 tpnce note the setting is invalid when the tpnctl1.tpneee bit = 1. (b) tmpn control register 1 (tpnctl1) 0 0 0/1 0 0 tpnctl1 100 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest 1, 0, 0: pwm output mode 0: operate on count clock selected by tpncks0 to tpncks2 bits 1: count external event input signal (c) tmpn i/o control register 0 (tpnioc0) 0 0 0 0 0/1 tpnioc0 0: disable topn0 pin output 1: enable topn0 pin output setting of topn0 pin output level before count operation 0: low level 1: high level 0: disable topn1 pin output 1: enable topn1 pin output setting of topn1 pin output level before count operation 0: low level 1: high level 0/1 0/1 0/1 note tpnoe1 tpnol0 tpnoe0 tpnol1 topn1 pin output 16-bit counter ? when tpnol1 bit = 0 topn1 pin output 16-bit counter ? when tpnol1 bit = 1 note clear this bit to 0 when the topn0 pi n is not used in the pwm output mode.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 307 figure 7-30. register setting in pwm output mode (2/2) (d) tmpn i/o control register 2 (tpnioc2) 0 0 0 0 0/1 tpnioc2 select valid edge of external event count input (tipn0 pin). 0/1 0 0 tpnees0 tpnets1 tpnets0 tpnees1 (e) tmpn counter read bu ffer register (tpncnt) the value of the 16-bit counter can be read by reading the tpncnt register. (f) tmpn capture/compare register s 0 and 1 (tpnccr0 and tpnccr1) if d 0 is set to the tpnccr0 register and d 1 to the tpnccr1 register, the cycle and active level of the pwm waveform are as follows. cycle = (d 0 + 1) count clock cycle active level width = d 1 count clock cycle remarks 1. tmpn i/o control register 1 (tpnioc1) and tmpn option register 0 (tpnopt0) are not used in the pwm output mode. 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 308 (1) operation flow in pwm output mode figure 7-31. software processing flow in pwm output mode (1/2) ffffh 16-bit counter 0000h tpnce bit tpnccr0 register ccr0 buffer register inttpncc0 signal topn0 pin output tpnccr1 register ccr1 buffer register inttpncc1 signal topn1 pin output d 10 d 00 d 00 d 01 d 00 d 00 d 10 d 10 d 11 d 10 d 10 d 10 d 11 d 10 d 01 d 00 d 10 d 10 d 00 d 10 d 00 d 11 d 11 d 01 d 01 d 01 <1> <2> <3> <4> <5> remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 309 figure 7-31. software processing flow in pwm output mode (2/2) tpnce bit = 1 setting of tpnccr0 register register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc0 register, tpnioc2 register, tpnccr0 register, tpnccr1 register initial setting of these registers is performed before setting the tpnce bit to 1. the tpncks0 to tpncks2 bits can be set at the same time when counting is enabled (tpnce bit = 1). writing the same value (same as preset value of the tpnccr1 register) to the tpnccr1 register is necessary only when the set cycle is changed. when the counter is cleared after setting, the value of the tpnccrm register is transferred to the ccrm buffer register. start setting of tpnccr1 register <1> count operation start flow <2> tpnccr0, tpnccr1 register setting change flow (frequency only) setting of tpnccr0 register when the counter is cleared after setting, the value of the tpnccrm register is transferred to the ccrm buffer register. setting of tpnccr1 register <4> tpnccr0, tpnccr1 register setting change flow (frequency and duty) only writing of the tpnccr1 register must be performed when the set duty factor is changed. when the counter is cleared after setting, the value of compare register m is transferred to the ccrm buffer register. setting of tpnccr1 register <3> tpnccr0, tpnccr1 register setting change flow (duty only) tpnce bit = 0 counting is stopped. stop <5> count operation stop flow remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 310 (2) pwm output mode operation timing (a) changing pulse width during operation to change the pwm waveform while the counter is operating, write the tpnccr1 register last. rewrite the tpnccrm register after writing the tpnccr 1 register after the inttpncc1 signal is detected. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register ccr0 buffer register tpnccr1 register ccr1 buffer register topn1 pin output inttpncc0 signal d 10 d 00 d 00 d 01 d 00 d 10 d 11 d 10 d 11 d 01 d 10 d 10 d 00 d 00 d 11 d 11 d 01 d 01 to transfer data from the tpnccrm register to the ccrm buffer register, the tpnccr1 register must be written. to change both the cycle and active level of the pwm waveform at this time, first set the cycle to the tpnccr0 register and then set the active level to the tpnccr1 register. to change only the cycle of the pwm waveform, first set the cycle to the tpnccr0 register, and then write the same value (same as preset value of t he tpnccr1 register) to the tpnccr1 register. to change only the active level width (duty factor) of the pwm waveform, only the tpnccr1 register has to be set. after data is written to the tpnccr1 register, the val ue written to the tpnccrm register is transferred to the ccrm buffer register in synchronization with clear ing of the 16-bit counter, and is used as the value compared with the 16-bit counter. to write the tpnccr0 or tpnccr1 register again after writing the tpnccr1 register once, do so after the inttpncc0 signal is generated. otherwise, the value of the ccrm buffer register may become undefined because the timing of transferring data from the tpn ccrm register to the ccrm buffer register conflicts with writing the tpnccrm register. remark n = 0 to 8, m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 311 (b) 0%/100% output of pwm waveform to output a 0% waveform, set the tpnccr1 register to 0000h. the 16-bit counter is cleared to 0000h and the inttpncc0 and inttpncc1 signals are generate d at the next timing after a match between the count value of the 16-bit counter and t he value of the ccr0 buffer register. count clock 16-bit counter tpnce bit tpnccr0 register tpnccr1 register inttpncc0 signal inttpncc1 signal topn1 pin output d 00 0000h d 00 0000h d 00 0000h d 00 ? 1d 00 0000 ffff 0000 d 00 ? 1d 00 0000 0001 l remark n = 0 to 8 to output a 100% waveform, set a value of (set value of tpnccr0 register + 1) to the tpnccr1 register. if the set value of the tpnccr0 register is ffffh, 100% output cannot be produced. d 00 d 00 + 1 d 00 d 00 + 1 d 00 d 00 + 1 d 00 0000 ffff 0000 d 00 0000 0001 count clock 16-bit counter tpnce bit tpnccr0 register tpnccr1 register inttpncc0 signal inttpncc1 signal topn1 pin output d 00 ? 1d 00 ? 1 l remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 312 (c) generation timing of compare match interrupt request signal (inttpncc1) the timing of generation of the inttpncc1 signal in the pwm output mode differs from the timing of other mode inttpncc1 signals; the inttpncc1 signal is gen erated when the count val ue of the 16-bit counter matches the value of the tpnccr1 register. count clock 16-bit counter tpnccr1 register topn1 pin output inttpncc1 signal d 1 d 1 ? 2d 1 ? 1d 1 d 1 + 1 d 1 + 2 remark n = 0 to 8 usually, the inttpncc1 signal is generated in synch ronization with the next counting up after the count value of the 16-bit counter matches the value of the tpnccr1 register. in the pwm output mode, however, it is generated one clock earlier. this is because the timing is changed to match the change timing of the output signal of the topn1 pin.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 313 7.6.6 free-running timer mode (t pnmd2 to tpnmd0 bits = 101) in the free-running timer mode, 16-bit timer/event counter p starts counting when the tpnctl0.tpnce bit is set to 1. at this time, the tpnccrm register can be used as a compare register or a capt ure register, depending on the setting of the tpnopt0.tpnccs 0 and tpnopt0.tpnccs1 bits. figure 7-32. configuration in free-running timer mode tpnccr0 register (capture) tpnce bit tpnccr1 register (compare) 16-bit counter tpnccr1 register (compare) tpnccr0 register (capture) output controller tpnccs0, tpnccs1 bits (capture/compare selection) topn0 pin note 1 output controller topn1 pin note 2 edge detector count clock selection edge detector edge detector tipn0 pin note 1 (external event count input/ capture trigger input) tipn1 pin note 2 (capture trigger input) internal count clock 0 1 0 1 inttpnov signal inttpncc1 signal inttpncc0 signal notes 1. because the external event count input pin (tipn0), capture trigger input pin (tipn0), and timer output pin (topn0) share the same alte rnate-function pin, two or more functions cannot be used at the same time. 2. because the capture trigger input pin (tipa1) and timer output pin (topa1) are the same alternate-function pin, two or more func tions cannot be used at the same time. remark n = 0 to 8 m = 0, 1 a = 0 to 6, 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 314 ? compare operation when the tpnce bit is set to 1, 16-bit timer/event counter p starts counting, and the output signals of the topn0 and topn1 pins are inverted. when the count value of the 16-bit counter later matches the set value of the tpnccrm register, a compare match interrupt request signal (inttpnccm) is generated, and the output signals of the topnm pins are inverted. the 16-bit counter continues counting in synchronization with the count cloc k. when it counts up to ffffh, it generates an overflow interrupt request signal (inttpnov) at the next clock, is cleared to 0000h, and continues counting. at this time, the overflow flag (tpnopt0.tpnovf bi t) is also set to 1. confirm that the overflow flag is set to 1 and then clear it to 0 by executing the clr instruction via software. the tpnccrm register can be rewritten while the counter is operating. if it is rewritten, the new value is reflected at that time by anytime write, and compared with the count value. figure 7-33. basic timing in free-r unning timer mode (compare function) ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal topn0 pin output tpnccr1 register inttpncc1 signal topn1 pin output inttpnov signal tpnovf bit d 00 d 01 d 10 d 11 d 00 d 10 d 10 d 11 d 11 d 11 d 00 d 01 d 01 cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 315 ? capture operation when the tpnce bit is set to 1, the 16-bit counter starts counting. when the valid edge input to the tipnm pin is detected, the count value of the 16-bi t counter is stored in the tpnccrm register, and a capture interrupt request signal (inttpnccm) is generated. the 16-bit counter continues counting in synchronization with the count cloc k. when it counts up to ffffh, it generates an overflow interrupt request signal (inttpnov) at the next clock, is cleared to 0000h, and continues counting. at this time, the overflow flag (tpnopt0.tpnovf bi t) is also set to 1. confirm that the overflow flag is set to 1 and then clear it to 0 by executing the clr instruction via software. figure 7-34. basic timing in free-r unning timer mode (capture function) ffffh 16-bit counter 0000h tpnce bit tipn0 pin input tpnccr0 register inttpncc0 signal tipn1 pin input tpnccr1 register inttpncc1 signal inttpnov signal tpnovf bit d 00 d 01 d 02 d 03 d 10 d 00 d 01 d 02 d 03 d 11 d 12 d 13 d 10 d 11 d 12 d 13 cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 316 figure 7-35. register setting in free-running timer mode (1/3) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 select count clock note 0: stop counting 1: enable counting 0/1 0/1 0/1 tpncks2 tpncks1 tpncks0 tpnce note the setting is invalid when the tpnctl1.tpneee bit = 1 (b) tmpn control register 1 (tpnctl1) 0 0 0/1 0 0 tpnctl1 101 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest 1, 0, 1: free-running timer mode 0: operate with count clock selected by tpncks0 to tpncks2 bits 1: count on external event count input signal (c) tmpn i/o control register 0 (tpnioc0) 0 0 0 0 0/1 tpnioc0 0: disable topn0 pin output 1: enable topn0 pin output setting output level of topn0 pin before count operation 0: low level 1: high level 0: disable topn1 pin output 1: enable topn1 pin output setting output level of topn1 pin before count operation 0: low level 1: high level 0/1 0/1 0/1 tpnoe1 tpnol0 tpnoe0 tpnol1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 317 figure 7-35. register setting in free-running timer mode (2/3) (d) tmpn i/o control register 1 (tpnioc1) 0 0 0 0 0/1 tpnioc1 select valid edge of tipn0 pin input note select valid edge of tipn1 pin input 0/1 0/1 0/1 tpnis2 tpnis1 tpnis0 tpnis3 note set the valid edge selection of the unused alternat e external input signals to ?no edge detection?. (e) tmpn i/o control register 2 (tpnioc2) 0 0 0 0 0/1 tpnioc2 select valid edge of external event count input (tipn0 pin) note 0/1 0 0 tpnees0 tpnets1 tpnets0 tpnees1 note set the valid edge selection of the unused alternat e external input signals to ?no edge detection?. (f) tmpn option register 0 (tpnopt0) 0 0 0/1 0/1 0 tpnopt0 overflow flag specifies if tpnccr0 register functions as capture or compare register 0: compare register 1: capture register specifies if tpnccr1 register functions as capture or compare register 0: compare register 1: capture register 0 0 0/1 tpnccs0 tpnovf tpnccs1 (g) tmpn counter read bu ffer register (tpncnt) the value of the 16-bit counter can be read by reading the tpncnt register.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 318 figure 7-35. register setting in free-running timer mode (3/3) (h) tmpn capture/compare regist ers 0 and 1 (tpnccr0 and tpnccr1) these registers function as captur e registers or compare registers depending on the setting of the tpnopt0.tpnccsm bit. when the registers function as captur e registers, they store the count value of the 16-bit counter when the valid edge input to the tipnm pin is detected. when the registers function as compare registers and when d m is set to the tpnccrm register, the inttpnccm signal is generated when the counter reaches (d m + 1), and the output signal of the topnm pin is inverted. remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 319 (1) operation flow in free-running timer mode (a) when using capture/compare register as compare register figure 7-36. software processing flow in fr ee-running timer mode (c ompare function) (1/2) d 00 d 01 d 10 d 11 d 00 d 10 d 10 d 11 d 11 d 11 d 00 d 01 d 01 cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction <1> <2> <2> <2> <3> ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal topn0 pin output tpnccr1 register inttpncc1 signal topn1 pin output inttpnov signal tpnovf bit remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 320 figure 7-36. software processing flow in fr ee-running timer mode (c ompare function) (2/2) tpnce bit = 1 read tpnopt0 register (check overflow flag). register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc0 register, tpnioc2 register, tpnopt0 register, tpnccr0 register, tpnccr1 register initial setting of these registers is performed before the tpnce bit is set to 1. the tpncks0 to tpncks2 bits can be set when counting starts (tpnce bit = 1). start execute instruction to clear tpnovf bit (clr tpnovf). <1> count operation start flow <2> overflow flag clear flow tpnce bit = 0 counter is initialized and counting is stopped by clearing tpnce bit to 0. stop <3> count operation stop flow tpnovf bit = 1 no yes remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 321 (b) when using capture/compare register as capture register figure 7-37. software processing flow in fr ee-running timer mode (c apture function) (1/2) ffffh 16-bit counter 0000h tpnce bit tipn0 pin input tpnccr0 register inttpncc0 signal tipn1 pin input tpnccr1 register inttpncc1 signal inttpnov signal tpnovf bit d 00 0000 0000 d 01 d 02 d 03 d 10 d 00 d 01 d 02 d 03 d 11 d 12 d 10 0000 d 11 d 12 0000 cleared to 0 by clr instruction cleared to 0 by clr instruction <3> <1> <2> <2> remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 322 figure 7-37. software processing flow in fr ee-running timer mode (c apture function) (2/2) tpnce bit = 1 read tpnopt0 register (check overflow flag). register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc1 register, tpnopt0 register initial setting of these registers is performed before the tpnce bit is set to 1. the tpncks0 to tpncks2 bits can be set when counting starts (tpnce bit = 1). start execute instruction to clear tpnovf bit (clr tpnovf). <1> count operation start flow <2> overflow flag clear flow tpnce bit = 0 counter is initialized and counting is stopped by clearing tpnce bit to 0. stop <3> count operation stop flow tpnovf bit = 1 no yes remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 323 (2) operation timing in free-running timer mode (a) interval operation with compare register when 16-bit timer/event counter p is used as an in terval timer with the tpnccrm register used as a compare register, software processing is necessary for setting a comparison value to generate the next interrupt request signal each time the inttpnccm signal has been detected. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal topn0 pin output tpnccr1 register inttpncc1 signal topn1 pin output d 00 d 01 d 02 d 03 d 04 d 05 d 10 d 00 d 11 d 01 d 12 d 04 d 13 d 02 d 03 d 11 d 10 d 12 d 13 d 14 interval period (d 10 + 1) interval period (10000h + d 11 ? d 10 ) interval period (10000h + d 12 ? d 11 ) interval period (10000h + d 13 ? d 12 ) interval period (d 00 + 1) interval period (10000h + d 01 ? d 00 ) interval period (d 02 ? d 01 ) interval period (10000h + d 03 ? d 02 ) interval period (10000h + d 04 ? d 03 ) when performing an interval operation in the free-running timer mode, two intervals can be set with one channel. to perform the interval operation, the value of the corresponding tpnccr m register must be re-set in the interrupt servicing that is executed when the inttpnccm signal is detected. the set value for re-setting the tpnccrm register c an be calculated by the following expression, where ?d m ? is the interval period. compare register default value: d m ? 1 value set to compare register second and subsequent time: previous set value + d m (if the calculation result is greate r than ffffh, subtract 10000h from the result and set this value to the register.) remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 324 (b) pulse width measurement with capture register when pulse width measurement is performed with the tpnccrm register used as a capture register, software processing is necessary for reading the capt ure register each time the inttpnccm signal has been detected and for calculating an interval. ffffh 16-bit counter 0000h tpnce bit tipn0 pin input tpnccr0 register inttpncc0 signal tipn1 pin input tpnccr1 register inttpncc1 signal inttpnov signal tpnovf bit 0000h d 00 d 01 d 02 d 03 d 04 d 10 d 00 d 11 d 01 d 12 d 04 d 13 d 02 d 03 d 10 0000h d 11 d 12 d 13 pulse interval (d 00 ) pulse interval (10000h + d 01 ? d 00 ) pulse interval (d 02 ? d 01 ) pulse interval (10000h + d 03 ? d 02 ) pulse interval (10000h + d 04 ? d 03 ) pulse interval (d 10 ) pulse interval (10000h + d 11 ? d 10 ) pulse interval (10000h + d 12 ? d 11 ) pulse interval (10000h + d 13 ? d 12 ) cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction when executing pulse width measurement in the fr ee-running timer mode, two pulse widths can be measured with one channel. to measure a pulse width, the pu lse width can be calculated by reading the value of the tpnccrm register in synchronization with the inttpnccm si gnal, and calculat ing the difference between the read value and the previously read value. remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 325 (c) processing of overflow when two capture registers are used care must be exercised in processing the overflow flag when two capture registers are used. first, an example of incorrect processing is shown below. example of incorrect processing when two capture regi sters are used ffffh 16-bit counter 0000h tpnce bit tipn0 pin input tpnccr0 register tipn1 pin input tpnccr1 register inttpnov signal tpnovf bit d 00 d 01 d 10 d 11 d 10 <1> <2> <3> <4> d 00 d 11 d 01 the following problem may occur when two pulse widt hs are measured in the free-running timer mode. <1> read the tpnccr0 register (setting of t he default value of the tipn0 pin input). <2> read the tpnccr1 register (setting of t he default value of the tipn1 pin input). <3> read the tpnccr0 register. read the overflow flag. if the overflow flag is 1, clear it to 0. because the overflow flag is 1, the pulse width can be calculated by (10000h + d 01 ? d 00 ). <4> read the tpnccr1 register. read the overflow flag. because the flag is cleared in <3>, 0 is read. because the overflow flag is 0, the pulse width can be calculated by (d 11 ? d 10 ) (incorrect). remark n = 0 to 8 when two capture registers are used, and if the overflow flag is cleared to 0 by one capture register, the other capture register may not obtain the correct pulse width. use software when using two capture registers. an example of how to use software is shown below.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 326 (1/2) example when two capture registers are used (usi ng overflow interrupt) ffffh 16-bit counter 0000h tpnce bit inttpnov signal tpnovf bit tpnovf0 flag note tipn0 pin input tpnccr0 register tpnovf1 flag note tipn1 pin input tpnccr1 register d 10 d 11 d 00 d 01 d 10 <1> <2> <5> <6> <3> <4> d 00 d 11 d 01 note the tpnovf0 and tpnovf1 flags are set on the internal ram by software. <1> read the tpnccr0 register (setting of t he default value of the tipn0 pin input). <2> read the tpnccr1 register (setting of t he default value of the tipn1 pin input). <3> an overflow occurs. set the tpnovf0 and tpnovf 1 flags to 1 in the overflow interrupt servicing, and clear the overflow flag to 0. <4> read the tpnccr0 register. read the tpnovf0 flag. if the tpnovf0 flag is 1, clear it to 0. because the tpnovf0 flag is 1, the pulse width can be calculated by (10000h + d 01 ? d 00 ). <5> read the tpnccr1 register. read the tpnovf1 flag. if the tpnovf1 flag is 1, clear it to 0 (the tpnovf0 flag is cleared in <4>, and the tpnovf1 flag remains 1). because the tpnovf1 flag is 1, the puls e width can be calculated by (10000h + d 11 ? d 10 ) (correct). <6> same as <3> remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 327 (2/2) example when two capture re gisters are used (without using overflow interrupt) ffffh 16-bit counter 0000h tpnce bit inttpnov signal tpnovf bit tpnovf0 flag note tipn0 pin input tpnccr0 register tpnovf1 flag note tipn1 pin input tpnccr1 register d 10 d 11 d 00 d 01 d 10 <1> <2> <5> <6> <3> <4> d 00 d 11 d 01 l note the tpnovf0 and tpnovf1 flags are set on the internal ram by software. <1> read the tpnccr0 register (setting of t he default value of the tipn0 pin input). <2> read the tpnccr1 register (setting of t he default value of the tipn1 pin input). <3> an overflow occurs. nothing is done by software. <4> read the tpnccr0 register. read the overflow flag. if the overflow flag is 1, set only the tpnovf1 flag to 1, and clear the overflow flag to 0. because the overflow flag is 1, the pulse width can be calculated by (10000h + d 01 ? d 00 ). <5> read the tpnccr1 register. read the overflow flag. because the overflow flag is cleared in <4>, 0 is read. read the tpnovf1 flag. if the tpnovf1 flag is 1, clear it to 0. because the tpnovf1 flag is 1, the pulse width can be calculated by (10000h + d 11 ? d 10 ) (correct). <6> same as <3> remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 328 (d) processing of overflow if capture trigger interval is long if the pulse width is greater than one cycle of the 16- bit counter, care must be exercised because an overflow may occur more than once from the first captur e trigger to the next. first, an example of incorrect processing is shown below. example of incorrect processing when capture trigger interval is long ffffh 16-bit counter 0000h tpnce bit tipnm pin input tpnccrm register inttpnov signal tpnovf bit d m0 d m1 d m0 d m1 <1> <2> <3> <4> 1 cycle of 16-bit counter pulse width the following problem may occur when long pulse width is measured in the free-running timer mode. <1> read the tpnccrm register (setting of t he default value of the tipnm pin input). <2> an overflow occurs. nothing is done by software. <3> an overflow occurs a second time. nothing is done by software. <4> read the tpnccrm register. read the overflow flag. if the overflow flag is 1, clear it to 0. because the overflow flag is 1, the pul se width can be calculated by (10000h + d m1 ? d m0 ) (incorrect). actually, the pulse width must be (20000h + d m1 ? d m0 ) because an overflow occurs twice. remark n = 0 to 8 m = 0, 1 if an overflow occurs twice or more when the capture tr igger interval is long, the correct pulse width may not be obtained. if the capture trigger interval is long, slow the count clock to lengthen one cycle of the 16-bit counter, or use software. an example of how to use software is shown next.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 329 example when capture trigger interval is long ffffh 16-bit counter 0000h tpnce bit tipnm pin input tpnccrm register inttpnov signal tpnovf bit overflow counter note d m0 d m1 1h 0h 2h 0h d m0 d m1 <1> <2> <3> <4> 1 cycle of 16-bit counter pulse width note the overflow counter is set arbitrarily by software on the internal ram. <1> read the tpnccrm register (setting of t he default value of the tipnm pin input). <2> an overflow occurs. increment the overflow count er and clear the overflow flag to 0 in the overflow interrupt servicing. <3> an overflow occurs a second time. increment (+1) the overflow counter and clear the overflow flag to 0 in the overflow interrupt servicing. <4> read the tpnccrm register. read the overflow counter. when the overflow counter is ?n?, t he pulse width can be calculated by (n 10000h + d m1 ? d m0 ). in this example, the pulse width is (20000h + d m1 ? d m0 ) because an overflow occurs twice. clear the overflow counter (0h). remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 330 (e) clearing overflow flag the overflow flag can be cleared to 0 by clearing t he tpnovf bit to 0 with the clr instruction after reading the tpnovf bit when it is 1 and by writing 8-bi t data (bit 0 is 0) to t he tpnopt0 register after reading the tpnovf bit when it is 1. (3) note on capture operation if the capture operation is used and if a slow clock is selected as the count clock, ffffh, not 0000h, may be captured to the tpnccrm register if the capture trigge r is input immediately after the tpnctl0.tpnce bit is set to 1. count clock 0000h ffffh tpnce bit tpnccr0 register ffffh 0001h 0000h tipn0 pin input capture trigger input 16-bit counter sampling clock capture trigger input remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 331 7.6.7 pulse width measurement mode (tpnmd2 to tpnmd0 bits = 110) in the pulse width measurement mode, 16-bit timer/event counter p starts counting when the tpnctl0.tpnce bit is set to 1. each time the valid edge input to the tipnm pin has been detected, the count value of the 16-bit counter is stored in the tpnccrm register, and the 16-bit counter is cleared to 0000h. the interval of the valid edge can be measured by reading the tpnccrm register after a capture interrupt request signal (inttpnccm) occurs. for example, in case of figure 7-39, select either t he tipn0 or tipn1 pin as the capture trigger input pin, and specify ?no edge detected? by using the tpnioc1 register for the unused pins. figure 7-38. configuration in pulse width measurement mode tpnccr0 register (capture) tpnce bit tpnccr1 register (capture) count clock selection edge detector edge detector tipn0 pin (capture trigger input) tipn1 pin (capture trigger input) clear inttpnov signal inttpncc0 signal inttpncc1 signal 16-bit counter caution when in pulse width measurement mode, select the internal clock (set tpnctl1.tpneee bit = 0) as the count clock. remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 332 figure 7-39. basic timing in pulse width measurement mode ffffh 16-bit counter 0000h tpnce bit tipnm pin input tpnccrm register inttpnccm signal inttpnov signal tpnovf bit d 0 0000h d 1 d 2 d 3 cleared to 0 by clr instruction remark n = 0 to 8 m = 0, 1 when the tpnce bit is set to 1, the 16- bit counter starts counting. when the valid edge input to the tipnm pin is later detected, the count value of the 16-bit counter is stored in the tpnccrm register, the 16-bit counter is cleared to 0000h, and a capture interrupt request signal (inttpnccm) is generated. the pulse width is calculated as follows. pulse width = captured value count clock cycle if the valid edge is not input to the tipnm pin even wh en the 16-bit counter counted up to ffffh, an overflow interrupt request signal (inttpnov) is generated at the next count clock, and the counter is cleared to 0000h and continues counting. at this time, the overflow flag (tpnopt0.t pnovf bit) is also set to 1. clear the overflow flag to 0 by executing the clr instruction via software. if the overflow flag is set to 1, the pu lse width can be calculated as follows. pulse width = (10000h tpnovf bit set (1) count + captured value) count clock cycle remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 333 figure 7-40. register setting in pu lse width measurement mode (1/2) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 select count clock 0: stop counting 1: enable counting 0/1 0/1 0/1 tpncks2 tpncks1 tpncks0 tpnce (b) tmpn control register 1 (tpnctl1) 00000 tpnctl1 110 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest 1, 1, 0: pulse width measurement mode 0: operate with count clock selected by tpncks0 to tpncks2 bits (c) tmpn i/o control register 1 (tpnioc1) 0 0 0 0 0/1 tpnioc1 select valid edge of tipn0 pin input select valid edge of tipn1 pin input 0/1 0/1 0/1 tpnis2 tpnis1 tpnis0 tpnis3
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 334 figure 7-40. register setting in pu lse width measurement mode (2/2) (d) tmpn option register 0 (tpnopt0) 00000 tpnopt0 overflow flag 0 0 0/1 tpnccs0 tpnovf tpnccs1 (e) tmpn counter read bu ffer register (tpncnt) the value of the 16-bit counter can be read by reading the tpncnt register. (f) tmpn capture/compare register s 0 and 1 (tpnccr0 and tpnccr1) these registers store the count va lue of the 16-bit counter when the valid edge input to the tipnm pin is detected. remarks 1. tmpn i/o control register 0 (tpnioc0) and tmpn i/o control register 2 (tpnioc2) are not used in the pulse width measurement mode. 2. n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 335 (1) operation flow in pul se width measurement mode figure 7-41. software processing flow in pulse width measurement mode <1> <2> tpnce bit = 1 tpnce bit = 0 register initial setting tpnctl0 register (tpncks0 to tpncks2 bits), tpnctl1 register, tpnioc1 register, tpnopt0 register initial setting of these registers is performed before the tpnce bit is set to 1. the tpncks0 to tpncks2 bits can be set when counting starts (tpnce bit = 1). the counter is initialized and counting is stopped by clearing the tpnce bit to 0. start stop <1> count operation start flow <2> count operation stop flow ffffh 16-bit counter 0000h tpnce bit tipn0 pin input tpnccr0 register inttpncc0 signal d 0 0000h 0000h d 1 d 2 remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 336 (2) operation timing in pul se width measurement mode (a) clearing overflow flag the overflow flag can be cleared to 0 by clearing t he tpnovf bit to 0 with the clr instruction after reading the tpnovf bit when it is 1 and by writing 8-bi t data (bit 0 is 0) to t he tpnopt0 register after reading the tpnovf bit when it is 1. (3) notes if a slow clock is selected as the count clock, ffffh, not 0000h, may be captured to the tpnccrm register if the capture trigger is input immediately afte r the tpnctl0.tpnce bit has been set to 1. count clock 0000h ffffh tpnce bit tpnccr0 register ffffh 0002h 0000h tipn0 pin input capture trigger input 16-bit counter sampling clock capture trigger input remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 337 7.7 selector function in the v850es/sj2 and v850es/sj2-h, t he tip input or rxda input and the tiq input or tsout signal can be selected as the capture trigger input of tmp and tmq, respectively. by using this function, the following become possible. ? the tiq02 and tiq03 input signals of tmq0 can be selected from the time r alternate-function pins (tiq02 and tiq03 pins) of the port and the ts out signal of the can controller. if the tsout signal of can0 or can1 is selected, t he time stamp function of t he can controller can be used. ? the tip10 and tip11 input signals of tmp1 can be sele cted from the timer alternat e-function pins (tip10 and tip11 pins) of the port and the uarta reception alternate-function pins (rxda0 and rxda1). the tip31 input signal of tmp3 can be selected from the timer alternat e-function pin (tip31 pin) of the port and the uarta reception alternate-function pin (rxda3). when the rxda0, rxda1, or rxda3 signal of uart0, uart1, or uart3 is se lected, the lin reception transfer rate and baud rate error of uarta can be calculated. cautions 1. when using the selector function, set the capture trigger input of tmp or tmq before connecting the timer. 2. when setting the selector function, firs t disable the peripheral i/o to be connected (tmp/uarta or tmq/can controller). the capture input for the selector functi on is specified by the following register.
chapter 7 16-bit timer/event counter p (tmp) user?s manual u16603ej5v1ud 338 (1) selector operation control register 0 (selcnt0) the selcnt0 register is an 8-bit register that se lects the capture trigger for tmp1, tmp3, and tmq0. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 selcnt0 isel6 0 isel4 isel3 0 isel1 isel0 tip31 pin input rxda3 pin input isel6 0 1 selection of tip31 input signal (tmp3) tip11 pin input rxda1 pin input isel4 0 1 selection of tip11 input signal (tmp1) tip10 pin input rxda0 pin input isel3 0 1 selection of tip10 input signal (tmp1) tiq03 pin input tsout signal of can1 isel1 note 1 0 1 selection of tiq03 input signal (tmq0) tiq02 pin input tsout signal of can0 isel0 note 2 0 1 selection of tiq02 input signal (tmq0) after reset: 00h r/w address: fffff308h < > < > < > < > < > notes 1. the isel1 bit is valid only for t he can controller (2-channel) version. 2. the isel0 bit is valid only for the can controller version. caution to set the isel0, isel1, isel3, isel4, an d isel6 bits to ?1?, set the corresponding pin in the capture input mode.
user?s manual u16603ej5v1ud 339 chapter 8 16-bit timer/event counter q (tmq) timer q (tmq) is a 16-bit timer/event counter. the v850es/sj2 and v850es/sj2-h incorporate tmq0. 8.1 overview an outline of tmq0 is shown below. ? clock selection: 8 ways ? capture/trigger input pins: 4 ? external event count input pins: 1 ? external trigger input pins: 1 ? timer/counters: 1 ? capture/compare registers: 4 ? capture/compare match interrupt request signals: 4 ? overflow interrupt request signals: 1 ? timer output pins: 4 8.2 functions tmq0 has the following functions. ? interval timer ? external event counter ? external trigger pulse output ? one-shot pulse output ? pwm output ? free-running timer ? pulse width measurement
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 340 8.3 configuration tmq0 includes the following hardware. table 8-1. configuration of tmq0 item configuration timer register 16-bit counter registers tmq0 capture/compare registers 0 to 3 (tq0ccr0 to tq0ccr3) tmq0 counter read buffer register (tq0cnt) ccr0 to ccr3 buffer registers timer inputs 4 (tiq00 note 1 to tiq03 pins) timer outputs 4 (toq00 to toq03 pins) control registers note 2 tmq0 control registers 0, 1 (tq0ctl0, tq0ctl1) tmq0 i/o control registers 0 to 2 (tq0ioc0 to tq0ioc2) tmq0 option register 0 (tq0opt0) notes 1. the tiq00 pin functions alternately as a capt ure trigger input signal, external event count input signal, and external trigger input signal. 2. when using the functions of the tiq00 to tiq03 and toq00 to toq03 pins, see table 4-19 using port pin as alternate-function pin . figure 8-1. block diagram of tmq0 tq0cnt tq0ccr0 tq0ccr1 tq0ccr2 toq00 inttq0ov ccr2 buffer register tq0ccr3 ccr3 buffer register toq01 toq02 toq03 inttq0cc0 inttq0cc1 inttq0cc2 inttq0cc3 f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 f xx /128 tiq00 tiq01 tiq02 tiq03 selector internal bus internal bus selector edge detector ccr0 buffer register ccr1 buffer register 16-bit counter output controller clear remark f xx : main clock frequency
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 341 (1) 16-bit counter this 16-bit counter can count inte rnal clocks or external events. the count value of this counter can be read by using the tq0cnt register. when the tq0ctl0.tq0ce bit = 0, the va lue of the 16-bit counter is ffffh. if the tq0cnt register is read at this time, 0000h is read. reset sets the tq0ce bit to 0. (2) ccr0 buffer register this is a 16-bit compare register that com pares the count value of the 16-bit counter. when the tq0ccr0 register is used as a compare regist er, the value written to the tq0ccr0 register is transferred to the ccr0 buffer register. when the count value of the 16-bit counter matches the value of the ccr0 buffer register, a compare match interrupt request signal (inttq0cc0) is generated. the ccr0 buffer register cannot be read or written directly. the ccr0 buffer register is cleared to 0000h after reset, as the tq0ccr0 register is cleared to 0000h. (3) ccr1 buffer register this is a 16-bit compare register that com pares the count value of the 16-bit counter. when the tq0ccr1 register is used as a compare regist er, the value written to the tq0ccr1 register is transferred to the ccr1 buffer register. when the count value of the 16-bit counter matches the value of the ccr1 buffer register, a compare match interrupt request signal (inttq0cc1) is generated. the ccr1 buffer register cannot be read or written directly. the ccr1 buffer register is cleared to 0000h after reset, as the tq0ccr1 register is cleared to 0000h. (4) ccr2 buffer register this is a 16-bit compare register that com pares the count value of the 16-bit counter. when the tq0ccr2 register is used as a compare regist er, the value written to the tq0ccr2 register is transferred to the ccr2 buffer register. when the count value of the 16-bit counter matches the value of the ccr2 buffer register, a compare match interrupt request signal (inttq0cc2) is generated. the ccr2 buffer register cannot be read or written directly. the ccr2 buffer register is cleared to 0000h after reset, as the tq0ccr2 register is cleared to 0000h. (5) ccr3 buffer register this is a 16-bit compare register that com pares the count value of the 16-bit counter. when the tq0ccr3 register is used as a compare regist er, the value written to the tq0ccr3 register is transferred to the ccr3 buffer register. when the count value of the 16-bit counter matches the value of the ccr3 buffer register, a compare match interrupt request signal (inttq0cc3) is generated. the ccr3 buffer register cannot be read or written directly. the ccr3 buffer register is cleared to 0000h after reset, as the tq0ccr3 register is cleared to 0000h. (6) edge detector this circuit detects the valid edges input to the tiq00 to tiq03 pins. no edge, rising edge, falling edge, or both the rising and falling edges can be selected as the va lid edge by using the tq0ioc1 and tq0ioc2 registers. (7) output controller this circuit controls the output of the toq00 to toq 03 pins. the output contro ller is controlled by the tq0ioc0 register. (8) selector this selector selects the count clock for the 16-bit counter . eight types of internal clocks or an external event can be selected as the count clock.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 342 8.4 registers the registers that control tmq0 are as follows. ? tmq0 control register 0 (tq0ctl0) ? tmq0 control register 1 (tq0ctl1) ? tmq0 i/o control register 0 (tq0ioc0) ? tmq0 i/o control register 1 (tq0ioc1) ? tmq0 i/o control register 2 (tq0ioc2) ? tmq0 option register 0 (tq0opt0) ? tmq0 capture/compare register 0 (tq0ccr0) ? tmq0 capture/compare register 1 (tq0ccr1) ? tmq0 capture/compare register 2 (tq0ccr2) ? tmq0 capture/compare register 3 (tq0ccr3) ? tmq0 counter read buffer register (tq0cnt) remark when using the functions of the tiq00 to tiq03 and toq00 to toq03 pins, see table 4-19 using port pin as alternate-function pin .
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 343 (1) tmq0 control register 0 (tq0ctl0) the tq0ctl0 register is an 8-bit register that controls the operation of tmq0. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. the same value can always be written to the tq0ctl0 register by software. tq0ce tmq0 operation disabled (tmq0 reset asynchronously note ). tmq0 operation enabled. tmq0 operation started. tq0ce 0 1 tmq0 operation control tq0ctl0 0 0 0 0 tq0cks2 tq0cks1 tq0cks0 654321 after reset: 00h r/w address: fffff540h <7> 0 f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 f xx /128 tq0cks2 0 0 0 0 1 1 1 1 internal count clock selection tq0cks1 0 0 1 1 0 0 1 1 tq0cks0 0 1 0 1 0 1 0 1 note the tq0opt0.tq0ovf bit and 16-bit c ounter are reset at the same time. in addition, the timer output pins (toq00 to toq03 pins) are reset to the status set by the tq0ioc0 register when the 16-bit counter is reset. cautions 1. set the tq0cks2 to tq0 cks0 bits when the tq0ce bit = 0. when the value of the tq0ce bi t is changed from 0 to 1, the tq0cks2 to tq0cks0 bits can be set simultaneously. 2. be sure to clear bits 3 to 6 to ?0?. remark f xx : main clock frequency
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 344 (2) tmq0 control register 1 (tq0ctl1) the tq0ctl1 register is an 8-bit register that controls the operation of tmq0. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 tq0est 0 1 software trigger control tq0ctl1 tq0est tq0eee 0 0 tq0md2 tq0md1 tq0md0 <6> <5> 4 3 2 1 after reset: 00h r/w address: fffff541h generate a valid signal for external trigger input. ? in one-shot pulse output mode: a one-shot pulse is output with writing 1 to the tq0est bit as the trigger. ? in external trigger pulse output mode: a pwm waveform is output with writing 1 to the tq0est bit as the trigger. disable operation with external event count input (tiq00 pin). (perform counting with the count clock selected by the tq0ctl0.tq0cks0 to tq0ctl0.tq0cks2 bits.) tq0eee 0 1 count clock selection the tq0eee bit selects whether counting is performed with the internal count clock or the valid edge of the external event count input. 7 0 interval timer mode external event count mode external trigger pulse output mode one-shot pulse output mode pwm output mode free-running timer mode pulse width measurement mode setting prohibited tq0md2 0 0 0 0 1 1 1 1 timer mode selection tq0md1 0 0 1 1 0 0 1 1 tq0md0 0 1 0 1 0 1 0 1 enable operation with external event count input (tiq00pin). (perform counting at the valid edge of the external event count input signal.) ? the read value of tq0est bit is always 0. cautions 1. the tq0est bit is valid on ly in the external trigger pulse output mode or one-shot pulse output mode . in any other mode, writing 1 to this bit is ignored. 2. external event count input is selected in the external event count mode regardless of the value of the tq0eee bit. 3. set the tq0eee and tq0md2 to tq0md0 bits when the tq0ctl0.tq0ce bit = 0. (the same value can be written when the tq0ce bit = 1.) the op eration is not guaranteed when rewriting is performed with the tq0ce bit = 1. if rewriting was mistakenly performed, clear the tq0ce bit to 0 and then set the bits again. 4. be sure to clear bits 3, 4, and 7 to ?0?.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 345 (3) tmq0 i/o control register 0 (tq0ioc0) the tq0ioc0 register is an 8-bit register that controls the timer output (toq00 to toq03 pins). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. tq0ol3 tq0olm 0 1 toq0m pin output level setting (m = 0 to 3) note toq0m pin high level start toq0m pin low level start tq0ioc0 tq0oe3 tq0ol2 tq0oe2 tq0ol1 tq0oe1 tq0ol0 tq0oe0 <6> 5 <4> 3 <2> 1 after reset: 00h r/w address: fffff542h tq0oem 0 1 toq0m pin output setting (m = 0 to 3) timer output disabled ? when tq0olm bit = 0: low level is output from the toq0m pin ? when tq0olm bit = 1: high level is output from the toq0m pin 7 <0> timer output enabled (a pulse is output from the toq0m pin). note the output level of the timer output pin (toq0m) specified by the tq0olm bit is shown below. tq0ce bit toq0m pin output 16-bit counter ? when tq0olm bit = 0 tq0ce bit toq0m pin output 16-bit counter ? when tq0olm bit = 1 cautions 1. the pin output changes if the setting of the tq0ioc0 register is rewritten when the port is set to output toq0m. therefore, note changes in the pin status by setting the port in the input mode and making the output status of the pins a high- impedance state. 2. rewrite the tq0olm and tq0oem bits when the tq0ctl0.tq0ce bit = 0. (the same value can be written when the tq0ce bit = 1.) if rewriting was mistakenly performed, clear the tq0ce bit to 0 and then set the bits again. 3. even if the tq0olm bit is manipulated when the tq0ce and tq0oem bits are 0, the toq0 m pin output level varies. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 346 (4) tmq0 i/o control register 1 (tq0ioc1) the tq0ioc1 register is an 8-bit register that controls the valid edge of the capture trigger input signals (tiq00 to tiq03 pins). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. tq0is7 tq0is7 0 0 1 1 tq0is6 0 1 0 1 capture trigger input signal (tiq03 pin) valid edge setting no edge detection (capture operation invalid) detection of rising edge detection of falling edge detection of both edges tq0ioc1 tq0is6 tq0is5 tq0is4 tq0is3 tq0is2 tq0is1 tq0is0 654321 after reset: 00h r/w address: fffff543h tq0is5 0 0 1 1 tq0is4 0 1 0 1 capture trigger input signal (tiq02 pin) valid edge detection no edge detection (capture operation invalid) detection of rising edge detection of falling edge detection of both edges 7 0 tq0is3 0 0 1 1 tq0is2 0 1 0 1 capture trigger input signal (tiq01 pin) valid edge setting no edge detection (capture operation invalid) detection of rising edge detection of falling edge detection of both edges tq0is1 0 0 1 1 tq0is0 0 1 0 1 capture trigger input signal (tiq00 pin) valid edge setting no edge detection (capture operation invalid) detection of rising edge detection of falling edge detection of both edges cautions 1. rewrite the tq0is7 to tq0is0 bits when the tq0ctl0.tq0ce bit = 0. (the same value can be written when the tq0ce bit = 1.) if rewriting was mistakenly performed, clear the tq0ce bit to 0 and then set the bits again. 2. the tq0is7 to tq0is0 bi ts are valid only in the free- running timer mode (tq0opt0.tq0ccsm bit = 1 only) and the pulse width measurement mode (m = 0 to 3). in all other modes, a capture operation is not possible.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 347 (5) tmq0 i/o control register 2 (tq0ioc2) the tq0ioc2 register is an 8-bit register that controls the valid edge of the external event count input signal (tiq00 pin) and external trigger input signal (tiq00 pin). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 tq0ees1 0 0 1 1 tq0ees0 0 1 0 1 external event count input signal (tiq00 pin) valid edge setting no edge detection (external event count invalid) detection of rising edge detection of falling edge detection of both edges tq0ioc2 0 0 0 tq0ees1 tq0ees0 tq0ets1 tq0ets0 654321 after reset: 00h r/w address: fffff544h tq0ets1 0 0 1 1 tq0ets0 0 1 0 1 external trigger input signal (tiq00 pin) valid edge setting no edge detection (external trigger invalid) detection of rising edge detection of falling edge detection of both edges 7 0 cautions 1. rewrite the tq0ees1, tq0ees0, tq0ets1, and tq0ets0 bits when the tq0ctl0.tq0ce bit = 0. (the same value can be written when the tq0ce bit = 1.) if rewriting was mistakenly performed, clear the tq0ce bit to 0 and then set the bits again. 2. the tq0ees1 and tq0ees0 bits are valid only when the tq0ctl1.tq0eee bit = 1 or when the external event count mode (tq0ctl1.tq0md 2 to tq0ctl1.tq0md0 bits = 001) has been set. 3. the tq0ets1 and tq0ets0 bits are valid only when the external trigger pulse output mode (tq0ctl1.tq0md2 to tq0ctl1.tq0md0 bits = 010) or the one-shot pulse output mode (tq0ctl1.tq0 md2 to tq0ctl1.tq0md0 = 011) is set.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 348 (6) tmq0 option register 0 (tq0opt0) the tq0opt0 register is an 8-bit register used to set the capture/co mpare operation and detect an overflow. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. tq0ccs3 tq0ccsm 0 1 tq0ccrm register capture/compare selection the tq0ccsm bit setting is valid only in the free-running timer mode. compare register selected capture register selected (cleared by setting the tq0ctl0.tq0ce bit = 0) tq0opt0 tq0ccs2 tq0ccs1 tq0ccs0 0 0 0 tq0ovf 654321 after reset: 00h r/w address: fffff545h tq0ovf set (1) reset (0) tmq0 overflow detection flag ? the tq0ovf bit is set to 1 when the 16-bit counter count value overflows from ffffh to 0000h in the free-running timer mode or the pulse width measurement mode. ? an overflow interrupt request signal (inttq0ov) is generated at the same time that the tq0ovf bit is set to 1. the inttq0ov signal is not generated in modes other than the free-running timer mode and the pulse width measurement mode. ? the tq0ovf bit is not cleared to 0 even when the tq0ovf bit or the tq0opt0 register are read when the tq0ovf bit = 1. ? before clearing the tq0ovf bit to 0 after the inttq0ov signal has been generated, be sure to confirm (read) that the tq0ovf bit is set to 1. ? the tq0ovf bit can be both read and written, but the tq0ovf bit cannot be set to 1 by software. writing 1 has no influence on the operation of tmq0. overflow occurred tq0ovf bit 0 written or tq0ctl0.tq0ce bit = 0 7 <0> cautions 1. rewrite the tq0ccs 3 to tq0ccs0 bits when the tq0ctl0.tq0ce bit = 0. (the same value can be written when the tq0ce bit = 1.) if rewriting was mistakenly performed, clear the tq0ce bit to 0 and then set the bits again. 2. be sure to clear bits 1 to 3 to ?0?. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 349 (7) tmq0 capture/compare register 0 (tq0ccr0) the tq0ccr0 register is a 16-bit r egister that can be used as a captur e register or a compare register depending on the mode. this register can be used as a capture register or a compare register only in the free-running timer mode, depending on the setting of the tq0o pt0.tq0ccs0 bit. in the pulse width measurement mode, the tq0ccr0 register can be used only as a capture register. in any other m ode, this register can be used only as a compare register. the tq0ccr0 register can be r ead or written during operation. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the tq0ccr0 register is prohibited in the following statuses. for details, see 3.4.9 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tq0ccr0 12 10 8 6 4 2 after reset: 0000h r/w address: fffff546h 14 0 13 11 9 7 5 3 15 1
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 350 (a) function as compare register the tq0ccr0 register can be rewritten even when the tq0ctl0.tq0ce bit = 1. the set value of the tq0ccr0 register is transferred to the ccr0 buffer register. when the value of the 16-bit counter matches the value of the ccr0 buffer register, a compare match interrupt request signal (inttq0cc0) is generated. if toq00 pin output is e nabled at this time, the output of the toq00 pin is inverted. when the tq0ccr0 register is used as a cycle register in the interval timer mode, external event count mode, external trigger pulse output mode, one-shot pulse output mode, or pwm output mode, the value of the 16-bit counter is cleared (0000h) if its count va lue matches the value of the ccr0 buffer register. the compare register is not cleared when the tq0ctl0.tq0ce bit = 0. (b) function as capture register when the tq0ccr0 register is used as a capture register in the free- running timer mode, the count value of the 16-bit counter is stored in the tq0ccr0 register if the valid ed ge of the capture trigger input pin (tiq00 pin) is detected. in the pulse-width measurement mode, the co unt value of the 16-bit counter is stored in the tq0ccr0 register and the 16-bit counter is cleared (0000h) if the valid edge of the capture trigger input pin (tiq00 pin) is detected. even if the capture operation and reading the tq0c cr0 register conflict, the correct value of the tq0ccr0 register can be read. the capture register is cleared when the tq0ctl0.tq0ce bit = 0. the following table shows the functions of the capture/compare re gister in each mode, and how to write data to the compare register. table 8-2. function of capture/co mpare register in each mode a nd how to write compare register operation mode capture/compare register how to write compare register interval timer compare register anytime write external event counter compare register anytime write external trigger pulse output compare register batch write note one-shot pulse output compare register anytime write pwm output compare register batch write note free-running timer capture/compare register anytime write pulse width measurement capture register none note triggered by writing to the tq0ccr1 register remark for anytime write and batch write, 8.6 (2) anytime write and batch write .
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 351 (8) tmq0 capture/compare register 1 (tq0ccr1) the tq0ccr1 register is a 16-bit r egister that can be used as a captur e register or a compare register depending on the mode. this register can be used as a capture register or a compare register only in the free-running timer mode, depending on the setting of the tq0o pt0.tq0ccs1 bit. in the pulse width measurement mode, the tq0ccr1 register can be used only as a capture register. in any other m ode, this register can be used only as a compare register. the tq0ccr1 register can be r ead or written during operation. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the tq0ccr1 register is prohibited in the following statuses. for details, see 3.4.9 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tq0ccr1 12 10 8 6 4 2 after reset: 0000h r/w address: fffff548h 14 0 13 11 9 7 5 3 15 1
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 352 (a) function as compare register the tq0ccr1 register can be rewritten even when the tq0ctl0.tq0ce bit = 1. the set value of the tq0ccr1 register is transferred to the ccr1 buffer register. when the value of the 16-bit counter matches the value of the ccr1 buffer register, a compare match interrupt request signal (inttq0cc1) is generated. if toq01 pin output is e nabled at this time, the output of the toq01 pin is inverted. the compare register is not cleared when the tq0ctl0.tq0ce bit = 0. (b) function as capture register when the tq0ccr1 register is used as a capture register in the free- running timer mode, the count value of the 16-bit counter is stored in the tq0ccr1 register if the valid ed ge of the capture trigger input pin (tiq01 pin) is detected. in the pulse-width measurement mode, the co unt value of the 16-bit counter is stored in the tq0ccr1 register and the 16-bit counter is cleared (0000h) if the valid edge of the capture trigger input pin (tiq01 pin) is detected. even if the capture operation and reading the tq0c cr1 register conflict, the correct value of the tq0ccr1 register can be read. the capture register is cleared when the tq0ctl0.tq0ce bit = 0. the following table shows the functions of the capture/compare re gister in each mode, and how to write data to the compare register. table 8-3. function of capture/co mpare register in each mode a nd how to write compare register operation mode capture/compare register how to write compare register interval timer compare register anytime write external event counter compare register anytime write external trigger pulse output compare register batch write note one-shot pulse output compare register anytime write pwm output compare register batch write note free-running timer capture/compare register anytime write pulse width measurement capture register none note triggered by writing to the tq0ccr1 register remark for anytime write and batch write, see 8.6 (2) anytime write and batch write .
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 353 (9) tmq0 capture/compare register 2 (tq0ccr2) the tq0ccr2 register is a 16-bit r egister that can be used as a captur e register or a compare register depending on the mode. this register can be used as a capture register or a compare register only in the free-running timer mode, depending on the setting of the tq0o pt0.tq0ccs2 bit. in the pulse width measurement mode, the tq0ccr2 register can be used only as a capture register. in any other m ode, this register can be used only as a compare register. the tq0ccr2 register can be r ead or written during operation. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the tq0ccr2 register is prohibited in the following statuses. for details, see 3.4.9 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tq0ccr2 12 10 8 6 4 2 after reset: 0000h r/w address: fffff54ah 14 0 13 11 9 7 5 3 15 1
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 354 (a) function as compare register the tq0ccr2 register can be rewritten even when the tq0ctl0.tq0ce bit = 1. the set value of the tq0ccr2 register is transferred to the ccr2 buffer register. when the value of the 16-bit counter matches the value of the ccr2 buffer register, a compare match interrupt request signal (inttq0cc2) is generated. if toq02 pin output is e nabled at this time, the output of the toq02 pin is inverted. the compare register is not cleared when the tq0ctl0.tq0ce bit = 0. (b) function as capture register when the tq0ccr2 register is used as a capture register in the free- running timer mode, the count value of the 16-bit counter is stored in the tq0ccr2 register if the valid ed ge of the capture trigger input pin (tiq02 pin) is detected. in the pulse-width measurement mode, the co unt value of the 16-bit counter is stored in the tq0ccr2 register and the 16-bit counter is cleared (0000h) if the valid edge of the capture trigger input pin (tiq02 pin) is detected. even if the capture operation and reading the tq0c cr2 register conflict, the correct value of the tq0ccr2 register can be read. the capture register is cleared when the tq0ctl0.tq0ce bit = 0. the following table shows the functions of the capture/compare re gister in each mode, and how to write data to the compare register. table 8-4. function of capture/co mpare register in each mode a nd how to write compare register operation mode capture/compare register how to write compare register interval timer compare register anytime write external event counter compare register anytime write external trigger pulse output compare register batch write note one-shot pulse output compare register anytime write pwm output compare register batch write note free-running timer capture/compare register anytime write pulse width measurement capture register none note triggered by writing to the tq0ccr1 register remark for anytime write and batch write, see 8.6 (2) anytime write and batch write .
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 355 (10) tmq0 capture/compare register 3 (tq0ccr3) the tq0ccr3 register is a 16-bit r egister that can be used as a captur e register or a compare register depending on the mode. this register can be used as a capture register or a compare register only in the free-running timer mode, depending on the setting of the tq0o pt0.tq0ccs3 bit. in the pulse width measurement mode, the tq0ccr3 register can be used only as a capture register. in any other m ode, this register can be used only as a compare register. the tq0ccr3 register can be r ead or written during operation. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the tq0ccr3 register is prohibited in the following statuses. for details, see 3.4.9 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tq0ccr3 12 10 8 6 4 2 after reset: 0000h r/w address: fffff54ch 14 0 13 11 9 7 5 3 15 1
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 356 (a) function as compare register the tq0ccr3 register can be rewritten even when the tq0ctl0.tq0ce bit = 1. the set value of the tq0ccr3 register is transferred to the ccr3 buffer register. when the value of the 16-bit counter matches the value of the ccr3 buffer register, a compare match interrupt request signal (inttq0cc3) is generated. if toq03 pin output is e nabled at this time, the output of the toq03 pin is inverted. the compare register is not cleared when the tq0ctl0.tq0ce bit = 0. (b) function as capture register when the tq0ccr3 register is used as a capture register in the free- running timer mode, the count value of the 16-bit counter is stored in the tq0ccr3 register if the valid ed ge of the capture trigger input pin (tiq03 pin) is detected. in the pulse-width measurement mode, the co unt value of the 16-bit counter is stored in the tq0ccr3 register and the 16-bit counter is cleared (0000h) if the valid edge of the capture trigger input pin (tiq03 pi) is detected. even if the capture operation and reading the tq0c cr3 register conflict, the correct value of the tq0ccr3 register can be read. the capture register is cleared when the tq0ctl0.tq0ce bit = 0. the following table shows the functions of the capture/compare re gister in each mode, and how to write data to the compare register. table 8-5. function of capture/co mpare register in each mode a nd how to write compare register operation mode capture/compare register how to write compare register interval timer compare register anytime write external event counter compare register anytime write external trigger pulse output compare register batch write note one-shot pulse output compare register anytime write pwm output compare register batch write note free-running timer capture/compare register anytime write pulse width measurement capture register none note triggered by writing to the tq0ccr1 register remark for anytime write and batch write, see 8.6 (2) anytime write and batch write .
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 357 (11) tmq0 counter read buffer register (tq0cnt) the tq0cnt register is a read buffer register that can read the count va lue of the 16-bit counter. if this register is read when the tq0ctl0.tq0ce bit = 1, the count value of the 16-bit timer can be read. this register is read-only, in 16-bit units. the value of the tq0cnt register is cleared to 0000h wh en the tq0ce bit = 0. if the tq0cnt register is read at this time, the value of the 16-bit count er (ffffh) is not read, but 0000h is read. the value of the tq0cnt register is cleared to 000 0h after reset, as the tq0ce bit is cleared to 0. caution accessing the tq0cnt register is prohibited in the following statuses. for details, see 3.4.9 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tq0cnt 12 10 8 6 4 2 after reset: 0000h r address: fffff54eh 14 0 13 11 9 7 5 3 15 1
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 358 8.5 timer output operations the following table shows the operations and out put levels of the toq00 to toq03 pins. table 8-6. timer output control in each mode operation mode toq00 pin toq 01 pin toq02 pin toq03 pin interval timer mode square wave output external event count mode none external trigger pulse output mode external trigger pulse output one-shot pulse output mode one-shot pulse output pwm output mode pwm output pwm output free-running timer mode square wave output (only when compare function is used) pulse width measurement mode none table 8-7. truth table of toq00 to toq03 pins under control of timer output control bits tq0ioc0.tq0olm bit tq0ioc0.tq0oem bit tq0ctl0.tq0ce bit level of toq0m pin 0 low-level output 0 low-level output 0 1 1 low level immediately before counting, high level after counting is started 0 high-level output 0 high-level output 1 1 1 high level immediately before counting, low level after counting is started remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 359 8.6 operation tmq0 can perform the following operations. operation tq0ctl1.tq0est bit (software trigger bit) tiq00 pin (external trigger input) capture/compare register setting compare register write interval timer mode invalid invalid compare only anytime write external event count mode note 1 invalid invalid compare only anytime write external trigger pulse output mode note 2 valid valid compare only batch write one-shot pulse output mode note 2 valid valid compare only anytime write pwm output mode invalid invalid compare only batch write free-running timer mode invalid invalid switching enabled anytime write pulse width measurement mode note 2 invalid invalid capture only not applicable notes 1. to use the external event count m ode, specify that the valid edge of the tiq00 pin capture trigger input is not detected (by clearing the tq0ioc1.tq0i s1 and tq0ioc1.tq0is0 bits to ?00?). 2. to use external trigger pulse output mode, one-shot pulse output mode or pulse width measurement mode, select the internal clock (set tq0ct l1.tq0eee bit = 0) as the count clock. (1) counter basic operation this section explains the basic oper ation of the 16-bit counter. for details, refer to the description of the operation in each mode. (a) counter start operation the 16-bit counter of tmq0 starts counti ng from the default value ffffh in all modes. it counts up from ffffh to 0000h, 0001h, 0002h, 0003h, and so on. (b) clear operation the 16-bit counter is cleared to 0000h when its value matches the value of the compare register and when its value is captured. the counting operation from ff ffh to 0000h that takes place immediately after the counter has started counting or when the counter overflows is not a clearing operation. therefore, the inttq0ccm interrupt signal is not generated (m = 0 to 3). (c) overflow operation the 16-bit counter overflows when the counter counts up from ffffh to 0000h in the free-running timer mode or pulse width measurement mode . if the counter overflows, the tq0opt0.tq0ovf bit is set to 1 and an interrupt request signal (inttq0ov) is generat ed. note that the inttq0ov signal is not generated under the following conditions. ? immediately after a count operation has been started ? if the counter value matches the compare value ffffh and is cleared ? when ffffh is captured in the pulse width measur ement mode and the counter counts up from ffffh to 0000h caution after the overflow interrupt request signa l (inttq0ov) has been generated, be sure to check that the overflow flag (tq0ovf bit) is set to 1.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 360 (d) counter read operation during counting operation the value of the 16-bit counter of tmq0 can be r ead by using the tq0cnt register during the count operation. when the tq0ctl0.tq0ce bit = 1, t he value of the 16-bit counter c an be read by reading the tq0cnt register. when the tq0ce bit = 0, the 16-bit counter is ffffh and the tq0cnt register is 0000h. (e) interrupt operation tmq0 generates the following five interrupt request signals. ? inttq0cc0 interrupt: this signal functions as a match interrupt request signal of the ccr0 buffer register and as a capture interrupt re quest signal to the tq0ccr0 register. ? inttq0cc1 interrupt: this signal functions as a match interrupt request signal of the ccr1 buffer register and as a capture interrupt re quest signal to the tq0ccr1 register. ? inttq0cc2 interrupt: this signal functions as a match interrupt request signal of the ccr2 buffer register and as a capture interrupt re quest signal to the tq0ccr2 register. ? inttq0cc3 interrupt: this signal functions as a match interrupt request signal of the ccr3 buffer register and as a capture interrupt re quest signal to the tq0ccr3 register. ? inttq0ov interrupt: this signal functions as an overflow interrupt request signal.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 361 (2) anytime write and batch write the tq0ccr0 to tq0ccr3 registers can be rewritten in the tmq0 during timer operation (tq0ctl0.tq0ce bit = 1), but the write method (anytime write, batch wr ite) of the ccr0 to ccr3 buffer registers differs depending on the mode. (a) anytime write in this mode, data is transferred at any time from the tq0ccr0 to tq0ccr3 registers to the ccr0 to ccr3 buffer registers during the timer operation. figure 8-2. flowchart of basic operation for anytime write start initial settings ? set values to tq0ccrm register ? timer operation enable (tq0ce bit = 1) transfer values of tq0ccrm register to ccrm buffer register timer operation ? match between 16-bit counter and ccrk buffer register note ? match between 16-bit counter and ccr0 buffer register ? 16-bit counter clear & start inttq0cc0 signal output tq0ccrm register rewrite transfer to ccrm buffer register inttq0cck signal output note the 16-bit counter is not cleared upon a match bet ween the 16-bit counter value and the ccrk buffer register value. it is cleared upon a match between t he 16-bit counter value and the ccr0 buffer register value. remarks 1. the above flowchart illustrates an example of the operation in the interval timer mode. 2. k = 1 to 3 m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 362 figure 8-3. timing of anytime write tq0ce bit = 1 16-bit counter tq0ccr0 register tq0ccr1 register tq0ccr2 register tq0ccr3 register inttq0cc0 signal inttq0cc1 signal inttq0cc2 signal inttq0cc3 signal ccr0 buffer register ccr1 buffer register ccr2 buffer register ccr3 buffer register 0000h d 11 d 11 d 12 d 11 d 11 d 12 d 12 d 21 d 21 d 21 d 01 d 01 d 02 d 02 d 01 d 12 d 21 0000h d 01 d 02 0000h d 21 d 31 0000h d 31 d 31 d 31 d 31 d 31 0000h ffffh remarks 1. d 01 , d 02 : setting values of tq0ccr0 register d 11 , d 12 : setting values of tq0ccr1 register d 21 : setting value of tq0ccr2 register d 31 : setting value of tq0ccr3 register 2. the above timing chart illustrates an example of the operation in the interval timer mode.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 363 (b) batch write in this mode, data is transferred all at once from the tq0ccr0 to tq0ccr3 registers to the ccr0 to ccr3 buffer registers during timer operation. this data is transferred upon a match between the value of the ccr0 buffer register and the value of the 16-bit counter. transfer is enabled by writing to the tq0ccr1 register. whether to enable or disable the next transfer timing is controlled by writing or not writing to the tq0ccr1 register. in order for the setting value when the tq0ccr0 to tq 0ccr3 registers are rewritten to become the 16-bit counter comparison value (in other words, in order fo r this value to be transferred to the ccr0 to ccr3 buffer registers), it is necessary to rewrite tq0ccr0 and finally write to the tq0ccr1 register before the 16-bit counter value and the ccr0 buffer register val ue match. the values of the tq0ccr0 to tq0ccr3 registers are transferred to the ccr0 to ccr3 buff er registers upon a match bet ween the count value of the 16-bit counter and the value of the ccr0 buffer register. thus, even when wishing only to rewrite the value of the tq0ccr0, tq0ccr2, or tq0ccr3 register, also write the same value (same as preset value of the tq0ccr1 register) to the tq0ccr1 register.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 364 figure 8-4. flowchart of basic operation for batch write start initial settings ? set values to tq0ccrm register ? timer operation enable (tq0ce bit = 1) transfer of values of tq0ccrm register to ccrm buffer register timer operation ? match between 16-bit counter and ccrk buffer register note ? match between 16-bit counter and ccr0 buffer register ? 16-bit counter clear & start ? transfer of values of tq0ccrk register to ccrk buffer register inttq0cck signal output tq0ccr0, tq0ccr2, tq0ccr3 register rewrite tq0ccr1 register rewrite inttq0cc0 signal output batch write enable note the 16-bit counter is not cleared upon a match bet ween the 16-bit counter value and the ccrk buffer register value. it is cleared upon a match between t he 16-bit counter value and the ccr0 buffer register value. caution writing to the tq0ccr1 regi ster includes enabling of batch wr ite. thus, rewrite the tq0ccr1 register after rewriting the tq0ccr0 , tq0ccr2, and tq0ccr3 registers. remarks 1. the above flowchart illustrates an example of the operation in the pwm output mode. 2. k = 1 to 3 m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 365 figure 8-5. timing of batch write tq0ce bit = 1 16-bit counter tq0ccr0 register tq0ccr1 register tq0ccr2 register tq0ccr3 register inttq0cc0 signal inttq0cc1 signal inttq0cc2 signal inttq0cc3 signal ccr0 buffer register ccr1 buffer register ccr2 buffer register ccr3 buffer register 0000h d 01 d 02 d 03 0000h d 11 0000h d 21 d 12 d 21 d 12 0000h d 31 d 32 d 33 d 31 d 32 d 33 d 01 d 02 d 03 d 11 d 12 d 12 d 21 d 31 d 11 d 01 d 21 d 21 d 12 d 12 d 12 d 12 d 32 d 32 d 32 d 02 d 02 d 03 toq00 pin output toq01 pin output toq02 pin output toq03 pin output d 21 d 21 note 1 note 1 same value write 0000h ffffh note 1 note 1 note 1 note 1 note 1 note 1 note 2 note 3 d 21 d 21 notes 1. because the tq0ccr1 register was not rewritten, d 02 is not transferred. 2. because tq0ccr1 register has been written (d 12 ), data is transferred to the ccr1 buffer register upon a match between the value of the 16-bit ti mer and the value of the tq0ccr0 register (d 01 ). 3. because tq0ccr1 register has been written (d 12 ), data is transferred to the ccr1 buffer register upon a match between the value of the 16-bit ti mer and the value of the tq0ccr0 register (d 12 ). remarks 1. d 01 , d 02 , d 03 : setting values of tq0ccr0 register d 11 , d 12 : setting values of tq0ccr1 register d 21 : setting value of tq0ccr2 register d 31 , d 32 , d 33 : setting values of tq0ccr3 register 2. the above timing chart illustrates the opera tion in the pwm output mode as an example.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 366 8.6.1 interval timer mode (t q0md2 to tq0md0 bits = 000) in the interval timer mode, an interrupt request signal (inttq0cc0) is generated at the interval set by the tq0ccr0 register if the tq0c tl0.tq0ce bit is set to 1. a square wave with a duty factor of 50% whose half cycle is equal to the interval can be output from the toq00 pin. the tq0ccr1 to tq0ccr3 registers are not used in the interval timer mode. however, the set value of the tq0ccr1 to tq0ccr3 registers is transferred to the ccr1 to ccr3 buffer registers and, when the count value of the 16-bit counter matches the value of the ccr1 to ccr3 bu ffer registers, compare match interrupt request signals (inttq0cc1 to inttq0cc3) are generated. in addition, a square wave with a duty factor of 50%, which is inverted when the inttq0cc1 to inttq0cc3 signals are generat ed, can be output from the toq01 to toq03 pins. the value of the tq0ccr1 to tq0ccr3 registers c an be rewritten even while the timer is operating. figure 8-6. configuration of interval timer 16-bit counter output controller ccr0 buffer register tq0ce bit tq0ccr0 register count clock selection clear match signal toq00 pin inttq0cc0 signal figure 8-7. basic timing of operation in interval timer mode ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register toq00 pin output inttq0cc0 signal d 0 d 0 d 0 d 0 d 0 interval (d 0 + 1) interval (d 0 + 1) interval (d 0 + 1) interval (d 0 + 1)
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 367 when the tq0ce bit is set to 1, the va lue of the 16-bit counter is cleared fr om ffffh to 0000h in synchronization with the count clock, and the counter starts counting. at this time, the output of the toq00 pin is inverted. additionally, the set value of the tq0ccr0 register is transferred to the ccr0 buffer register. when the count value of the 16-bit counter matches the valu e of the ccr0 buffer regi ster, the 16-bit counter is cleared to 0000h, the output of the toq00 pin is in verted, and a compare match interrupt request signal (inttq0cc0) is generated. the interval can be calculated by the following expression. interval = (set value of tq0ccr0 register + 1) count clock cycle figure 8-8. register setting for in terval timer mode operation (1/3) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 select count clock 0: stop counting 1: enable counting 0/1 0/1 0/1 tq0cks2 tq0cks1 tq0cks0 tq0ce (b) tmq0 control register 1 (tq0ctl1) 0 0 0/1 note 00 tq0ctl1 0, 0, 0: interval timer mode 000 tq0md2 tq0md1 tq0md0 tq0eee tq0est 0: operate on count clock selected by bits tq0cks0 to tq0cks2 1: count with external event count input signal note the tq0eee bit can be set to 1 only when the time r output (toq0k) is used. however, the tq0ccr0 and tq0ccrk registers must be set to the same value (k = 1 to 3).
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 368 figure 8-8. register setting for in terval timer mode operation (2/3) (c) tmq0 i/o control register 0 (tq0ioc0) 0/1 0/1 0/1 0/1 0/1 tq0ioc0 0: disable toq00 pin output 1: enable toq00 pin output setting of toq00 pin output before count operation 0: low level 1: high level 0: disable toq01 pin output 1: enable toq01 pin output setting of toq01 pin output before count operation 0: low level 1: high level 0/1 0/1 0/1 tq0oe1 tq0ol0 tq0oe0 tq0ol1 0: disable toq02 pin output 1: enable toq02 pin output setting of toq02 pin output before count operation 0: low level 1: high level 0: disable toq03 pin output 1: enable toq03 pin output setting of toq03 pin output before count operation 0: low level 1: high level tq0oe3 tq0ol2 tq0oe2 tq0ol3 (d) tmq0 i/o control register 2 (tq0ioc2) 0 0 0 0 0/1 note tq0ioc2 0/1 note 00 tq0ees0 tq0ets1 tq0ets0 tq0ees1 select valid edge of external event count input (tiq00 pin). note the tq0ees1 and tq0ees0 bits can be set onl y when timer outputs (toq00 to toq03) are used. however, set the tq0ccr0 to tq0ccr3 registers to the same value. (e) tmq0 counter read buffer register (tq0cnt) by reading the tq0cnt register, the count va lue of the 16-bit counter can be read. (f) tmq0 capture/compare register 0 (tq0ccr0) if the tq0ccr0 register is set to d 0 , the interval is as follows. interval = (d 0 + 1) count clock cycle
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 369 figure 8-8. register setting for in terval timer mode operation (3/3) (g) tmq0 capture/compare regist ers 1 to 3 (tq0ccr1 to tq0ccr3) the tq0ccr1 to tq0ccr3 registers ar e not used in the interval timer mode. however, the set value of the tq0ccr1 to tq0ccr3 registers are transferred to the ccr1 to ccr3 buffer registers. the toq01 to toq03 pin outputs are inverted and compare ma tch interrupt request signals (inttq0cc1 to inttq0cc3) are generated when the count value of t he 16-bit counter matches the value of the ccr1 to ccr3 buffer registers. when the tq0ccr1 to tq0ccr3 registers are not us ed, it is recommended to set their values to ffffh. also mask the registers by the in terrupt mask flags (tq0ccic0.tq0ccmk0 to tq0ccic3.tq0ccmk3). remark tmq0 i/o control register 1 (tq0ioc1) and tm q0 option register 0 (tq0opt0) are not used in the interval timer mode.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 370 (1) interval timer mode operation flow figure 8-9. software processing flow in interval timer mode tq0ce bit = 1 tq0ce bit = 0 register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc0 register, tq0ioc2 register note , tq0ccr0 register initial setting of these registers is performed before setting the tq0ce bit to 1. the tq0cks0 to tq0cks2 bits can be set at the same time when counting has been started (tq0ce bit = 1). the counter is initialized and counting is stopped by clearing the tq0ce bit to 0. the output level of the toq00 pin is as specified by the tq0ioc0 register. start stop <1> count operation start flow <2> count operation stop flow d 0 <1> <2> d 0 d 0 d 0 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register toq00 pin output inttq0cc0 signal note the tq0ees1 and tq0ees0 bits can be set only when timer output (toq0k) is used. however, set the tq0ccr0 and tq0ccrk registers to the same value (k = 1 to 3).
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 371 (2) interval timer mode operation timing (a) operation if tq0ccr0 re gister is set to 0000h if the tq0ccr0 register is set to 0000h, the inttq0cc0 signal is generated at each count clock, and the output of the toq00 pin is inverted. the value of the 16-bit counter is always 0000h. count clock 16-bit counter tq0ce bit tq0ccr0 register toq00 pin output inttq0cc0 signal 0000h interval time count clock cycle interval time count clock cycle interval time count clock cycle ffffh 0000h 0000h 0000h 0000h (b) operation if tq0ccr0 re gister is set to ffffh if the tq0ccr0 register is set to ffffh, the 16-bit co unter counts up to ffffh. the counter is cleared to 0000h in synchronization with the next count-up timing. the inttq0cc0 signal is generated and the output of the toq00 pin is inverted. at this time, an overflow interrupt request signal (inttq0ov) is not generated, nor is the overflow flag (tq0opt0.tq0ovf bit) set to 1. ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register toq00 pin output inttq0cc0 signal ffffh interval time 10000h count clock cycle interval time 10000h count clock cycle interval time 10000h count clock cycle
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 372 (c) notes on rewriting tq0ccr0 register when the value of the tq0ccr0 register is rewritten to a smaller value during counting, the 16-bit counter may overflow. if there is a possibility of ov erflow, stop counting and then change the set value. ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register tq0ol0 bit toq00 pin output inttq0cc0 signal d 1 d 2 d 1 d 1 d 2 d 2 d 2 l interval time (1) interval time (ng) interval time (2) remark interval time (1): (d 1 + 1) count clock cycle interval time (ng): (10000h + d 2 + 1) count clock cycle interval time (2): (d 2 + 1) count clock cycle if the value of the tq0ccr0 register is changed from d 1 to d 2 while the count value is greater than d 2 but less than d 1 , the count value is transferred to the ccr0 buff er register as soon as the tq0ccr0 register has been rewritten. consequently, the value of the 16-bit counter that is compared is d 2 . because the count value has already exceeded d 2 , however, the 16-bit c ounter counts up to ffffh, overflows, and then counts up again from 0000h. when the count value matches d 2 , the inttq0cc0 signal is generated and the output of the toq00 pin is inverted. therefore, the inttq0cc0 signal may not be generated at the interval time ?(d 1 + 1) count clock cycle? or ?(d 2 + 1) count clock cycle? originally expected, but may be generated at an interval of ?(10000h + d 2 + 1) count clock period?.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 373 (d) operation of tq0ccr1 to tq0ccr3 registers figure 8-10. configuration of tq0ccr1 to tq0ccr3 registers ccr0 buffer register tq0ce bit tq0ccr0 register clear match signal inttq0cc0 signal toq03 pin inttq0cc3 signal toq00 pin tq0ccr1 register ccr1 buffer register match signal toq01 pin inttq0cc1 signal tq0ccr3 register ccr3 buffer register match signal toq02 pin inttq0cc2 signal tq0ccr2 register ccr2 buffer register match signal output controller count clock selection output controller output controller output controller 16-bit counter
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 374 if the same value as the set value of the tq0ccr0 register is set to the tq0ccrk register, the inttq0cck signal is generated together with the inttq 0cc0 signal, and the output of the toq0k pin is inverted. this means that a square wave with a dut y factor of 50% can be output from the toq0k pin. if a value different from the set value of the tq0c cr0 register is set to the tq0ccrk register, the operation is as follows. if the set value of the tq0ccrk register is less than the set value of the tq0ccr0 register, the inttq0cck signal is generated once per cycle. at the same time, the output of the toq0k pin is inverted. the toq0k pin outputs a square wave with a duty factor of 50% after it first outputs a short-width pulse. remark k = 1 to 3 figure 8-11. timing chart when d 01 d k1 d 01 d 11 d 21 d 31 d 21 d 11 d 31 d 01 d 01 d 21 d 11 d 31 d 01 d 21 d 11 d 31 d 01 d 21 d 11 d 31 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register toq00 pin output inttq0cc0 signal tq0ccr1 register toq01 pin output inttq0cc1 signal tq0ccr2 register toq02 pin output inttq0cc2 signal tq0ccr3 register toq03 pin output inttq0cc3 signal
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 375 if the set value of the tq0ccrk regi ster is greater than the set value of the tq0ccr0 register, the count value of the 16-bit counter does not match the value of the tq0ccr k register. consequently, the inttq0cck signal is not generated, nor is the output of the toq0k pin changed. it is recommended to set ffffh to t he tq0ccrk register when the tq0ccrk register is not used. remark k = 1 to 3 figure 8-12. timing chart when d 01 < d k1 d 01 d 11 d 21 l l l d 31 d 01 d 01 d 01 d 01 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register toq00 pin output inttq0cc0 signal tq0ccr1 register toq01 pin output inttq0cc1 signal tq0ccr2 register toq02 pin output inttq0cc2 signal tq0ccr3 register toq03 pin output inttq0cc3 signal
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 376 (3) operation by external event count input (tiq00) (a) operation to count the 16-bit counter at the va lid edge of external event count input (tiq00) in the interval timer mode, the valid edge of the external event count input is necessary once because the 16-bit counter is cleared from ffffh to 0000h immediately afte r the tq0ce bit is set from 0 to 1. when 0001h is set to both the tq0ccr0 and tq0ccrk registers, the output of the toq0k pins is inverted each time the 16-bit counter counts twice (k = 1 to 3). the tq0ctl0.tq0eee bit can be set to 1 in the inte rval timer mode only when the timer output (toq0k) is used with the external event count input. tq0ce bit 16-bit counter tq0ccr0 register toq01 pin output tq0ccr1 register toq02 pin output tq0ccr2 register toq03 pin output tq0ccr3 register ffffh 0000h 0001h 0001h 0001h 0001h 0001h 0001h 0001h 0001h 0001h 0001h 0001h 0001h 0001h 0001h 0001h external event count input (tiq00 pin input) number of external events: 3 number of external events: 2 number of external events: 2 2-count width 2-count width 2-count width
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 377 8.6.2 external event count mode (tq0md2 to tq0md0 bits = 001) in the external event count mode, t he valid edge of the external event c ount input (tiq00) is counted when the tq0ctl0.tq0ce bit is set to 1, and an interrupt request signal (inttq0cc0) is generated each time the specified number of edges set by the tq0ccr0 register have be en counted. the toq00 to toq03 pins cannot be used. when using the toq00 to toq03 pins for external event count input, set the tq0ctl1.tq0eee bit to 1 in the interval timer mode (see 8.6.1 (3) operation by external event count input (tiq00) ). the tq0ccr1 to tq0ccr3 registers are not used in the external event count mode. caution in the external event count mode, the tq0 ccr0 to tq0ccr3 registers must not be cleared to 0000h. figure 8-13. configuration in external event count mode 16-bit counter ccr0 buffer register tq0ce bit tq0ccr0 register edge detector clear match signal inttq0cc0 signal tiq00 pin (external event count input)
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 378 figure 8-14. basic timing in external event count mode ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal d 0 d 0 d 0 d 0 16-bit counter tq0ccr0 register nttq0cc0 signal external event count input (tiq00 pin input) d 0 number of external event count (d 0 ) times note d 0 ? 1d 0 0000 0001 number of external event count (d 0 + 1) times number of external event count (d 0 + 1) times note in the external event count mode, the 16-bit c ounter is cleared from ffffh to 0000h as soon as the tq0ctl0.tq0ce bit has been set (1) (operation is started). the first counting operation is started from 0001h each time the valid edge of t he external event count input has been detected. therefore, the number of counts of the first counting operation is one less than that of the second counting operation. remark this figure shows the basic timing when the risi ng edge is specified as the valid edge of the external event count input.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 379 when the tq0ce bit is set to 1, the value of the 16-bit count er is cleared from ffffh to 0000h. the counter counts each time the valid edge of external event count input is detec ted. additionally, the set value of the tq0ccr0 register is transferred to the ccr0 buffer register. when the count value of the 16-bit counter matches the valu e of the ccr0 buffer regi ster, the 16-bit counter is cleared to 0000h, and a compare match interrupt request signal (inttq0cc0) is generated. the inttq0cc0 signal is generated for the first time when the valid edge of the external event count input has been detected ?value set to tq0ccr0 register? times. a fter that, the inttq0cc0 signal is generated each time the valid edge of the external event count has been detec ted ?value set to tq0ccr0 register + 1? times. figure 8-15. register setting for operati on in external event count mode (1/2) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 0: stop counting 1: enable counting 000 tq0cks2 tq0cks1 tq0cks0 tq0ce (b) tmq0 control register 1 (tq0ctl1) 00000 tq0ctl1 0, 0, 1: external event count mode 001 tq0md2 tq0md1 tq0md0 tq0eee tq0est (c) tmq0 i/o control register 2 (tq0ioc2) 0 0 0 0 0/1 tq0ioc2 select valid edge of external event count input (tiq00 pin) 0/1 0 0 tq0ees0 tq0ets1 tq0ets0 tq0ees1
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 380 figure 8-15. register setting for operati on in external event count mode (2/2) (d) tmq0 counter read buffer register (tq0cnt) the count value of the 16-bit counter can be read by reading the tq0cnt register. (e) tmq0 capture/compare register 0 (tq0ccr0) if the tq0ccr0 register is set to d 0 , the count is cleared when the number of external events has reached (d 0 ) and the first compare match interrupt request signal (inttq0cc0) is generated. the second compare match interrupt request signal (inttq0cc0) is generated when the number of external events has reached (d 0 + 1). (f) tmq0 capture/compare register s 1 to 3 (tq0ccr1 to tq0ccr3) the tq0ccr1 to tq0ccr3 registers are not used in t he external event count mode. however, the set value of the tq0ccr1 to tq0ccr3 registers are trans ferred to the ccr1 to ccr3 buffer registers. when the count value of the 16-bit counter matches t he value of the ccr1 to ccr3 buffer registers, compare match interrupt request signals (inttq0cc1 to inttq0cc3) are generated. when the tq0ccr1 to tq0ccr3 registers are not us ed, it is recommended to set their values to ffffh. also mask the registers by the in terrupt mask flags (t q0ccic1.tq0ccmk1 to tq0ccic3.tq0ccmk3). cautions 1. set the tq0ioc0 register to 00h. 2. when the external clock is used as the count clock, th e external clock can be input only from the tiq00 pin. at this time, clear the tq 0ioc1.tq0is1 and tq0ioc1.tq0is0 bits to 00 (capture trigge r input (tiq00 pin): no edge detected). remark the tmq0 i/o control register 1 (tq0ioc1) and tmq0 option register 0 (tq0opt0) are not used in the external event count mode.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 381 (1) external event count mode operation flow figure 8-16. flow of software processing in external event count mode ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal d 0 d 0 d 0 d 0 <1> <2> tq0ce bit = 1 tq0ce bit = 0 register initial setting tq0ctl1 register, tq0ioc2 register, tq0ccr0 to tq0ccr3 registers initial setting of these registers is performed before setting the tq0ce bit to 1. the counter is initialized and counting is stopped by clearing the tq0ce bit to 0. start stop <1> count operation start flow <2> count operation stop flow
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 382 (2) operation timing in external event count mode cautions 1. in the external even t count mode, do not set the tq0 ccr0 to tq0ccr3 registers to 0000h. 2. in the external event count mode, use of th e timer output (toq00 to toq03) is disabled. if using the timer outputs (toq01 to toq03) by the external event count input (tiq00), set the interval timer mode, and enable operati on by the external event count input for the count clock (tq0ctl1.tq0eee bit = 1). see 8.6. 1 (3) operation by external event count input (tiq00). (a) operation if tq0ccr0 re gister is set to ffffh if the tq0ccr0 register is set to ffffh, the 16-bit counter counts to ffffh each time the valid edge of the external event count signal has been detected. the 16-bit counter is cleared to 0000h in synchronization with the next count-up timing, and the in ttq0cc0 signal is generated. at this time, the tq0opt0.tq0ovf bit is not set. ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal ffffh number of external event count ffffh times number of external event count 10000h times number of external event count 10000h times
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 383 (b) notes on rewriting the tq0ccr0 register when the value of the tq0ccr0 register is rewritten to a smaller value during counting, the 16-bit counter may overflow. if there is a possibility of ov erflow, stop counting and then change the set value. ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal d 1 d 2 d 1 d 1 d 2 d 2 d 2 number of external event count (1) (d 1 ) times number of external event count (ng) (10000h + d 2 + 1) times number of external event count(2) (d 2 + 1) times if the value of the tq0ccr0 register is changed from d 1 to d 2 while the count value is greater than d 2 but less than d 1 , the count value is transferred to the ccr0 buff er register as soon as the tq0ccr0 register has been rewritten. consequently, the value t hat is compared with the 16-bit counter is d 2 . because the count value has already exceeded d 2 , however, the 16-bit c ounter counts up to ffffh, overflows, and then counts up again from 0000h. when the count value matches d 2 , the inttq0cc0 signal is generated. therefore, the inttq0cc0 signal may not be generated at the valid edge count of ?(d 1 + 1) times? or ?(d 2 + 1) times? originally expected, but may be generated at the valid edge count of ?(10000h + d 2 + 1) times?.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 384 (c) operation of tq0ccr1 to tq0ccr3 registers figure 8-17. configuration of tq0ccr1 to tq0ccr3 registers ccr0 buffer register tq0ce bit tq0ccr0 register clear match signal inttq0cc0 signal inttq0cc3 signal tiq00 pin (external event count input) tq0ccr1 register ccr1 buffer register match signal inttq0cc1 signal tq0ccr3 register ccr3 buffer register match signal inttq0cc2 signal tq0ccr2 register ccr2 buffer register match signal 16-bit counter edge detector
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 385 if the set value of the tq0ccrk register is smalle r than the set value of the tq0ccr0 register, the inttq0cck signal is generated once per cycle. remark k = 1 to 3 figure 8-18. timing chart when d 01 d k1 d 01 d 11 d 21 d 31 d 21 d 11 d 31 d 01 d 01 d 21 d 11 d 31 d 01 d 21 d 11 d 31 d 01 d 21 d 11 d 31 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal tq0ccr1 register inttq0cc1 signal tq0ccr2 register inttq0cc2 signal tq0ccr3 register inttq0cc3 signal
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 386 if the set value of the tq0ccrk regi ster is greater than the set va lue of the tq0ccr0 register, the inttq0cck signal is not generated because the count va lue of the 16-bit counter and the value of the tq0ccrk register do not match. it is recommended to set ffffh to the tq0ccrk register when the tq 0ccrk register is not used. remark k = 1 to 3 figure 8-19. timing chart when d 01 < d k1 d 01 d 11 d 21 l l l d 31 d 01 d 01 d 01 d 01 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal tq0ccr1 register inttq0cc1 signal tq0ccr2 register inttq0cc2 signal tq0ccr3 register inttq0cc3 signal
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 387 8.6.3 external trigger pulse output m ode (tq0md2 to tq0md0 bits = 010) in the external trigger pulse output mode, 16-bit ti mer/event counter q waits for a trigger when the tq0ctl0.tq0ce bit is set to 1. when the valid edge of an external trigger i nput signal (tiq00) is detected, 16-bit timer/event counter q starts counting, and outputs a pwm wave form (up to 3-phase) from the toq01 to toq03 pins. pulses can also be output by generating a software trigger instead of using the external trigger. when using a software trigger, a square wave with a duty factor of 50% wh ose half cycle is the set val ue of the tq0ccr0 register + 1 can also be output from the toq00 pin. figure 8-20. configuration in external trigger pulse output mode ccr0 buffer register tq0ce bit tq0ccr0 register clear match signal inttq0cc0 signal toq03 pin inttq0cc3 signal toq00 pin note transfer s r tq0ccr1 register ccr1 buffer register match signal toq01 pin inttq0cc1 signal transfer transfer s r tq0ccr3 register ccr3 buffer register match signal transfer toq02 pin inttq0cc2 signal s r tq0ccr2 register ccr2 buffer register match signal 16-bit counter count start control edge detector software trigger generation output controller (rs-ff) output controller output controller (rs-ff) output controller tiq00 pin note (external trigger input) count clock selection note because the external trigger input pin (tiq00) and timer output pin (toq00) share the same alternate- function pin, two functions cannot be used at the same time. caution in external trigger pulse output mode, select the internal clock (set the tq0ctl1.tq0eee bit = 0) as the count clock.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 388 figure 8-21. basic timing in exte rnal trigger pulse output mode d 1 d 2 d 3 d 1 d 2 d 3 d 1 d 2 d 3 d 1 d 1 d 2 d 3 active level width (d 2 ) active level width (d 2 ) active level width (d 2 ) active level width (d 3 ) active level width (d 3 ) cycle (d 0 + 1) cycle (d 0 + 1) wait for trigger active level width (d 3 ) cycle (d 0 + 1) ffffh 16-bit counter 0000h tq0ce bit external trigger input (tiq00 pin input) tq0ccr0 register inttq0cc0 signal toq00 pin output (only when software trigger is used) tq0ccr1 register inttq0cc1 signal toq01 pin output tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output active level width (d 1 ) active level width (d 1 ) active level width (d 1 ) active level width (d 1 ) active level width (d 1 ) d 0 d 1 d 3 d 2 d 0 d 0 d 0 d 0
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 389 16-bit timer/event counter q waits for a trigger when the tq0ce bit is set to 1. when the trigger is generated, the 16-bit counter is cleared from ffffh to 0000h, starts count ing at the same time, and out puts a pwm waveform from the toq0k pin. if the trigger is generated again while the counter is operating, the c ounter is cleared to 0000h and restarted. (the output of the toq00 pin is inverted. the toq0k pin outputs a high-level regardless of low-level output period and high-level output period statuses when a trigger occurs.) the active level width, cycle, and duty factor of the pwm waveform can be calculated as follows. active level width = (set value of tq0ccrk register) count clock cycle cycle = (set value of tq0ccr0 register + 1) count clock cycle duty factor = (set value of tq0ccrk regist er)/(set value of tq0ccr0 register + 1) the compare match request signal inttq0 cc0 is generated when the 16-bit c ounter counts next time after its count value matches the value of the c cr0 buffer register, and the 16-bit count er is cleared to 0000h. the compare match interrupt request signal inttq0cck is generated when the count value of the 16-bit counter matches the value of the ccrk buffer register. the value set to the tq0ccrm register is transferred to the ccrm buffer register w hen the count value of the 16- bit counter matches the value of the ccr0 buffer re gister and the 16-bit counter is cleared to 0000h. the valid edge of an external trigger input signal (tiq00), or setting the software trigger (tq0ctl1.tq0est bit) to 1 is used as the trigger. remark k = 1 to 3, m = 0 to 3 figure 8-22. setting of registers in exte rnal trigger pulse output mode (1/3) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 select count clock 0: stop counting 1: enable counting 0/1 0/1 0/1 tq0cks2 tq0cks1 tq0cks0 tq0ce
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 390 figure 8-22. setting of registers in exte rnal trigger pulse output mode (2/3) (b) tmq0 control register 1 (tq0ctl1) 0 0/1 0 0 0 tq0ctl1 0: operate on count clock selected by tq0cks0 to tq0cks2 bits generate software trigger when 1 is written 010 tq0md2 tq0md1 tq0md0 tq0eee tq0est 0, 1, 0: external trigger pulse output mode (c) tmq0 i/o control register 0 (tq0ioc0) 0/1 0/1 0/1 0/1 0/1 tq0ioc0 0: disable toq00 pin output 1: enable toq00 pin output setting of toq00 pin output level in status of waiting for external trigger 0: low level 1: high level 0: disable toq01 pin output 1: enable toq01 pin output setting of toq01 pin output level in status of waiting for external trigger 0: low level 1: high level 0/1 0/1 0/1 note tq0oe1 tq0ol0 tq0oe0 tq0ol1 toq0k pin output 16-bit counter ? when tq0olk bit = 0 toq0k pin output 16-bit counter ? when tq0olk bit = 1 tq0oe3 tq0ol2 tq0oe2 tq0ol3 setting of toq03 pin output level in status of waiting for external trigger 0: low level 1: high level 0: disable toq02 pin output 1: enable toq02 pin output setting of toq02 pin output level in status of waiting for external trigger 0: low level 1: high level 0: disable toq03 pin output 1: enable toq03 pin output note clear this bit to 0 when the toq00 pin is not used in the external trigger pulse output mode.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 391 figure 8-22. setting of registers in exte rnal trigger pulse output mode (3/3) (d) tmq0 i/o control register 2 (tq0ioc2) 00000 tq0ioc2 select valid edge of external trigger input (tiq00 pin) 0 0/1 0/1 tq0ees0 tq0ets1 tq0ets0 tq0ees1 (e) tmq0 counter read buffer register (tq0cnt) the value of the 16-bit counter can be read by reading the tq0cnt register. (f) tmq0 capture/compare register s 0 to 3 (tq0ccr0 to tq0ccr3) if d 0 is set to the tq0ccr0 register, d 1 to the tq0ccr1 register, d 2 to the tq0ccr2 register, and d 3 , to the tq0ccr3 register, the cycle and active level of the pwm waveform are as follows. cycle = (d 0 + 1) count clock cycle toq01 pin pwm waveform active level width = d 1 count clock cycle toq02 pin pwm waveform active level width = d 2 count clock cycle toq03 pin pwm waveform active level width = d 3 count clock cycle remarks 1. tmq0 i/o control register 1 (tq0ioc1) and tmq0 option register 0 (tq0opt0) are not used in the external trigger pulse output mode. 2. updating tmq0 capture/compare register 2 (tq0ccr2) and tmq0 capture/compare register 3 (tq0ccr3) is validated by writing tmq0 capture/compare register 1 (tq0ccr1).
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 392 (1) operation flow in extern al trigger pulse output mode figure 8-23. software processing flow in ex ternal trigger pulse output mode (1/2) d 10 d 10 d 10 d 20 d 30 d 00 d 11 d 21 d 01 d 31 d 11 d 21 d 00 d 31 d 20 d 30 d 00 d 21 d 00 d 31 d 11 d 21 d 00 d 31 ffffh 16-bit counter 0000h tq0ce bit external trigger input (tiq00 pin input) tq0ccr0 register ccr0 buffer register inttq0cc0 signal toq00 pin output (only when software trigger is used) tq0ccr1 register ccr1 buffer register inttq0cc1 signal toq01 pin output tq0ccr2 register ccr2 buffer register inttq0cc2 signal toq02 pin output tq0ccr3 register ccr3 buffer register inttq0cc3 signal toq03 pin output d 00 d 01 d 00 d 00 d 01 d 00 d 10 d 11 d 10 d 10 d 11 d 10 d 11 d 10 d 11 d 20 d 21 d 20 d 21 d 20 d 21 d 21 d 30 d 31 d 30 d 31 d 30 d 31 d 30 d 31 <1> <2> <3> <4> <5> <6> <7> d 11 d 11 d 20 d 10
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 393 figure 8-23. software processing flow in ex ternal trigger pulse output mode (2/2) start <1> count operation start flow tq0ce bit = 1 register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc0 register, tq0ioc2 register, tq0ccr0 to tq0ccr3 registers initial setting of these registers is performed before setting the tq0ce bit to 1. writing of the tq0ccr1 register must be performed when the set duty factor is only changed after writing the tq0ccr2 and tq0ccr3 registers. when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. writing the same value (same as the tq0ccr1 register already set) to the tq0ccr1 register is necessary only when the set duty factor of toq02 and toq03 pin outputs is changed. when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. only writing of the tq0ccr1 register must be performed when the set duty factor is only changed. when counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. counting is stopped. the tq0cks0 to tq0cks2 bits can be set at the same time when counting is enabled (tq0ce bit = 1). trigger wait status writing of the tq0ccr1 register must be performed after writing the tq0ccr0, tq0ccr2, and tq0ccr3 registers. when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer registers. writing the same value (same as the tq0ccr1 register already set) to the tq0ccr1 register is necessary only when the set cycle is changed. <2> tq0ccr0 to tq0ccr3 register setting change flow <3> tq0ccr0 register setting change flow <4> tq0ccr1 to tq0ccr3 register setting change flow <5> tq0ccr2 and tq0ccr3 register setting change flow <6> tq0ccr1 register setting change flow <7> count operation stop flow tq0ce bit = 0 setting of tq0ccr2, tq0ccr3 registers setting of tq0ccr1 register setting of tq0ccr2, tq0ccr3 registers setting of tq0ccr1 register stop setting of tq0ccr1 register setting of tq0ccr0 register setting of tq0ccr1 register setting of tq0ccr0, tq0ccr2, and tq0ccr3 registers tq0ccr1 register when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 394 (2) external trigger pulse output mode operation timing (a) note on changing pulse width during operation to change the pwm waveform while the counter is operating, write the tq0ccr1 register last. rewrite the tq0ccrk register after writing the tq0ccr1 register after the inttq0cc0 signal is detected. ffffh 16-bit counter 0000h tq0ce bit external trigger input (tiq00 pin input) d 30 d 00 d 01 d 30 d 30 d 20 d 20 d 20 d 21 d 11 d 00 d 00 d 31 d 01 d 01 d 21 d 11 d 31 tq0ccr0 register ccr0 buffer register inttq0cc0 signal tq0ccr1 register ccr1 buffer register inttq0cc1 signal toq01 pin output tq0ccr2 register ccr2 buffer register inttq0cc2 signal toq02 pin output tq0ccr3 register ccr3 buffer register inttq0cc3 signal toq03 pin output toq00 pin output (only when software trigger is used) d 10 d 10 d 10 d 00 d 11 d 10 d 11 d 10 d 21 d 20 d 21 d 20 d 31 d 30 d 31 d 30 d 00 d 01
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 395 in order to transfer data from the tq0ccrm register to the ccrm buffer register, the tq0ccr1 register must be written. to change both the cycle and active level width of the pwm waveform at this time, first set the cycle to the tq0ccr0 register, set the active level width to t he tq0ccr2 and tq0ccr3 registers, and then set an active level to the tq0ccr1 register. to change only the cycle of the pwm waveform, first set the cycle to the tq0ccr0 register, and then write the same value (same as the tq0ccr1 regist er already set) to the tq0ccr1 register. to change only the active level width (duty factor) of the pwm waveform, first set an active level to the tq0ccr2 and tq0ccr3 registers and then set an active level to the tq0ccr1 register. to change only the active level width (duty factor) of the pwm waveform output by the toq01 pin, only the tq0ccr1 register has to be set. to change only the active level width (duty factor) of the pwm waveform output by the toq02 and toq03 pins, first set an active level width to the tq0 ccr2 and tq0ccr3 registers, and then write the same value (same as the tq0ccr1 register already set) to the tq0ccr1 register. after data is written to the tq0ccr1 register, the value written to the tq0ccrm register is transferred to the ccrm buffer register in synchronization with clear ing of the 16-bit counter, and is used as the value compared with the 16-bit counter. to write the tq0ccr0 to tq0ccr3 registers again afte r writing the tq0ccr1 register once, do so after the inttq0cc0 signal is generated. otherwise, t he value of the ccrm buffer register may become undefined because timing of transferring data from t he tq0ccrm register to the ccrm buffer register conflicts with writing the tq0ccrm register. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 396 (b) 0%/100% output of pwm waveform to output a 0% waveform, set the tq0ccrk register to 0000h. the 16-bit counter is cleared to 0000h and the inttq0cc0 and inttq0cck signals are generated at the next timing after a match between the count value of the 16-bit counter and t he value of the ccr0 buffer register. count clock 16-bit counter tq0ce bit tq0ccr0 register tq0ccrk register inttq0cc0 signal inttq0cck signal toq0k pin output external trigger input (tiq00 pin input) d 0 l 0000h d 0 0000h d 0 0000h d 0 ? 1d 0 0000 ffff 0000 d 0 ? 1d 0 0000 0001 remark k = 1 to 3 to output a 100% waveform, set a value of (set value of tq0ccr0 register + 1) to the tq0ccrk register. if the set value of the tq0ccr0 register is ffffh, 100% output cannot be produced. d 0 d 0 + 1 d 0 d 0 + 1 d 0 d 0 + 1 d 0 0000 ffff 0000 d 0 0000 0001 count clock 16-bit counter tq0ce bit tq0ccr0 register tq0ccrk register inttq0cc0 signal inttq0cck signal toq0k pin output d 0 ? 1d 0 ? 1 external trigger input (tiq00 pin input) l remark k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 397 (c) conflict between trigger detection and match with ccrk buffer register if the trigger is detected immediately after the inttq 0cck signal is generated, the 16-bit counter is immediately cleared to 0000h, the output signal of t he toq0k pin is asserted, and the counter continues counting. consequently, the inactive peri od of the pwm waveform is shortened. 16-bit counter ccrk buffer register inttq0cck signal toq0k pin output external trigger input (tiq00 pin input) d k d k ? 1 0000 ffff 0000 shortened d k remark k = 1 to 3 if the trigger is detected immediately before the in ttq0cck signal is generated, the inttq0cck signal is not generated, and the 16-bit counter is cleared to 0000h and continues counting. t he output signal of the toq0k pin remains active. consequently, the active period of the pwm waveform is extended. 16-bit counter ccrk buffer register inttq0cck signal toq0k pin output external trigger input (tiq00 pin input) d k d k ? 2d k ? 1d k 0000 ffff 0000 0001 extended remark k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 398 (d) conflict between trigger detection and match with ccr0 buffer register if the trigger is detected immediately after the inttq 0cc0 signal is generated, the 16-bit counter is cleared to 0000h and continues counting up. therefore, the active period of the toq0k pin is extended by time from generation of the inttq0cc0 signal to trigger detection. 16-bit counter ccr0 buffer register inttq0cc0 signal toq0k pin output external trigger input (tiq00 pin input) d 0 d 0 ? 1d 0 0000 ffff 0000 0000 extended remark k = 1 to 3 if the trigger is detected immediately before the in ttq0cc0 signal is generated, the inttq0cc0 signal is not generated. the 16-bit counter is cleared to 0000h, the toq0k pin is asserted, and the counter continues counting. consequently, the inactive period of the pwm waveform is shortened. 16-bit counter ccr0 buffer register inttq0cc0 signal toq0k pin output external trigger input (tiq00 pin input) d 0 d 0 ? 1d 0 0000 ffff 0000 0001 shortened remark k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 399 (e) generation timing of compare match interrupt request signal (inttq0cck) the timing of generation of the inttq0cck signal in the external trigger pulse output mode differs from the timing of other mode inttq0cck signals; the inttq 0cck signal is generated when the count value of the 16-bit counter matches the value of the ccrk buffer register. count clock 16-bit counter ccrk buffer register toq0k pin output inttq0cck signal d k d k ? 2d k ? 1d k d k + 1 d k + 2 remark k = 1 to 3 usually, the inttq0cck signal is generated in synchro nization with the next count up after the count value of the 16-bit counter matches the va lue of the ccrk buffer register. in the external trigger pulse output mode, however, it is generated one clock earlier. this is because the timing is changed to match the timing of cha nging the output signal of the toq0k pin.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 400 8.6.4 one-shot pulse output mode (tq0md2 to tq0md0 bits = 011) in the one-shot pulse output mode, 16-bit timer/event coun ter q waits for a trigger when the tq0ctl0.tq0ce bit is set to 1. when the valid edge of an external trigger in put (tiq00) is detected, 16-bit timer/event counter q starts counting, and outputs a one-shot pulse from the toq01 to toq03 pins. instead of the external trigger, a software trigger can also be generated to output the pulse. the toq00 pin outputs the active level while the 16-bit counter is counting, and the inactive level when the counter is stopped (waiting for a trigger). figure 8-24. configuration in one-shot pulse output mode s r s r s r s r ccr0 buffer register tq0ce bit tq0ccr0 register clear match signal inttq0cc0 signal toq03 pin inttq0cc3 signal toq00 pin note transfer tq0ccr1 register ccr1 buffer register match signal toq01 pin inttq0cc1 signal transfer transfer tq0ccr3 register ccr3 buffer register match signal transfer toq02 pin inttq0cc2 signal tq0ccr2 register ccr2 buffer register match signal 16-bit counter count start control edge detector software trigger generation output controller (rs-ff) output controller (rs-ff) output controller (rs-ff) output controller (rs-ff) tiq00 pin note (external trigger input) count clock selection note because the external trigger input pin (tiq00) and timer output pin (toq00) share the same alternate- function pin, two functions cannot be used at the same time. caution in one-shot pulse output mode, select the internal clock ( set the tq0ctl1.tq0eee bit = 0) as the count clock.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 401 figure 8-25. basic timing in one-shot pulse output mode d 0 d 1 d 2 d 3 d 1 d 2 d 3 d 0 d 1 d 2 d 3 d 0 d 1 d 2 d 3 d 0 delay (d 1 ) active level width (d 0 ? d 1 + 1) delay (d 1 ) active level width (d 0 ? d 1 + 1) delay (d 1 ) active level width (d 0 ? d 1 + 1) delay (d 2 ) active level width (d 0 ? d 2 + 1) delay (d 2 ) active level width (d 0 ? d 2 + 1) delay (d 2 ) active level width (d 0 ? d 2 + 1) delay (d 3 ) active level width (d 0 ? d 3 + 1) delay (d 3 ) active level width (d 0 ? d 3 + 1) delay (d 3 ) active level width (d 0 ? d 3 + 1) ffffh 16-bit counter 0000h tq0ce bit external trigger input (tiq00 pin input) tq0ccr0 register inttq0cc0 signal tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output tq0ccr1 register inttq0cc1 signal toq01 pin output toq00 pin output (only when software trigger is used)
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 402 when the tq0ce bit is set to 1, 16-bit timer/event counter q waits for a trigger. when the trigger is generated, the 16-bit counter is cleared from ffffh to 0000h, starts counti ng, and outputs a o ne-shot pulse from the toq0k pin. after the one-shot pulse is output, the 16-bit counter is set to 0000h, stops counting, and waits for a trigger. when the trigger is generated again, the 16-bit counter starts counting from 0000h. if a trigger is generated again while the one-shot pulse is being output, it is ignored. the output delay period and active level width of the one-shot pulse can be calculated as follows. output delay period = (set value of tq0ccrk register) count clock cycle active level width = (set value of tq0ccr0 register ? set value of tq0ccrk register + 1) count clock cycle the compare match interrupt request signal inttq0cc0 is generated when the 16-bit counter counts after its count value matches the value of the ccr0 buffer register. the compare match interrupt request signal inttq0cck is generated when the count value of the 16-bit counter matches the va lue of the ccrk buffer register. the valid edge of an external trigger input (tiq00 pin) or setting the software trigger (tq0ctl1.tq0est bit) to 1 is used as the trigger. remark k = 1 to 3 figure 8-26. setting of registers in one-shot pulse output mode (1/3) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 select count clock 0: stop counting 1: enable counting 0/1 0/1 0/1 tq0cks2 tq0cks1 tq0cks0 tq0ce (b) tmq0 control register 1 (tq0ctl1) 0 0/1 0 0 0 tq0ctl1 0: generate software trigger when 1 is written 011 tq0md2 tq0md1 tq0md0 tq0eee tq0est 0, 1, 1: one-shot pulse output mode operate on count clock selected by tq0cks0 to tq0cks2 bits
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 403 figure 8-26. register setting in one-shot pulse output mode (2/3) (c) tmq0 i/o control register 0 (tq0ioc0) toq0k pin output 16-bit counter ? when tq0olk bit = 0 toq0k pin output 16-bit counter ? when tq0olk bit = 1 0/1 0/1 0/1 0/1 0/1 tq0ioc0 0: disable toq00 pin output 1: enable toq00 pin output setting of toq00 pin output level in status of waiting for external trigger 0: low level 1: high level 0: disable toq01 pin output 1: enable toq01 pin output setting of toq01 pin output level in status of waiting for external trigger 0: low level 1: high level 0/1 0/1 0/1 note tq0oe1 tq0ol0 tq0oe0 tq0ol1 tq0oe3 tq0ol2 tq0oe2 tq0ol3 setting of toq03 pin output level in status of waiting for external trigger 0: low level 1: high level 0: disable toq02 pin output 1: enable toq02 pin output setting of toq02 pin output level in status of waiting for external trigger 0: low level 1: high level 0: disable toq03 pin output 1: enable toq03 pin output note clear this bit to 0 when the toq00 pin is not used in the one-shot pulse output mode. (d) tmq0 i/o control register 2 (tq0ioc2) 00000 tq0ioc2 select valid edge of external trigger input (tiq00 pin) 0 0/1 0/1 tq0ees0 tq0ets1 tq0ets0 tq0ees1 (e) tmq0 counter read buffer register (tq0cnt) the value of the 16-bit counter can be read by reading the tq0cnt register.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 404 figure 8-26. register setting in one-shot pulse output mode (3/3) (f) tmq0 capture/compare register s 0 to 3 (tq0ccr0 to tq0ccr3) if d 0 is set to the tq0ccr0 register and d k to the tq0ccrk register, the active level width and output delay period of the one-shot pulse are as follows. active level width = (d 0 ? d k + 1) count clock cycle output delay period = d k count clock cycle caution if the set value of the tq0ccrk register is greater than the set value of the tq0ccr0 register in the one-shot pulse output mo de, the one-shot pulse is not output. remarks 1. tmq0 i/o control register 1 (tq0ioc1) and tmq0 option register 0 (tq0opt0) are not used in the one-shot pulse output mode. 2. k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 405 (1) operation flow in one-shot pulse output mode figure 8-27. software processing flow in one-shot pulse output mode (1/2) ffffh 16-bit counter 0000h tq0ce bit external trigger input (tiq00 pin input) tq0ccr0 register inttq0cc0 signal toq00 pin output (only when software trigger is used) tq0ccr1 register inttq0cc1 signal toq01 pin output tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output d 00 d 01 d 11 d 10 d 21 d 20 d 31 d 30 d 10 d 20 d 30 d 11 d 21 d 31 d 00 d 01 <3> <1> <2>
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 406 figure 8-27. software processing flow in one-shot pulse output mode (2/2) tq0ce bit = 1 register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc0 register, tq0ioc2 register, tq0ccr0 to tq0ccr3 registers initial setting of these registers is performed before setting the tq0ce bit to 1. the tq0cks0 to tq0cks2 bits can be set at the same time when counting has been started (tq0ce bit = 1). trigger wait status start <1> count operation start flow tq0ce bit = 0 count operation is stopped stop <3> count operation stop flow setting of tq0ccr0 to tq0ccr3 registers as rewriting the tq0ccrm register immediately forwards to the ccrm buffer register, rewriting immediately after the generation of the inttq0cc0 signal is recommended. <2> tq0ccr0 to tq0ccr3 register setting change flow remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 407 (2) operation timing in one-shot pulse output mode (a) note on rewriti ng tq0ccrm register when the value of the tq0ccr0 register is rewritten to a smaller value during counting, the 16-bit counter may overflow. if there is a possibility of ov erflow, stop counting and then change the set value. d k0 d k1 d 01 d 01 d 00 d k1 d 01 d k0 d k0 d k1 d 00 d 00 ffffh 16-bit counter 0000h tq0ce bit external trigger input (tiq00 pin input) tq0ccr0 register inttq0cc0 signal toq00 pin output (only when software trigger is used) tq0ccrk register inttq0cck signal toq0k pin output delay (d k0 ) active level width (d 00 ? d k0 + 1) active level width (d 01 ? d k1 + 1) active level width (d 01 ? d k1 + 1) delay (d k1 ) delay (10000h + d k1 ) when the tq0ccr0 register is rewritten from d 00 to d 01 and the tq0ccrk register from d k0 to d k1 where d 00 > d 01 and d k0 > d k1 , if the tq0ccrk register is rewritten when the count value of the 16-bit counter is greater than d k1 and less than d k0 and if the tq0ccr0 register is rewritten when the count value is greater than d 01 and less than d 00 , each set value is reflected as soon as the register has been rewritten and compared with the count value. the counter co unts up to ffffh and then counts up again from 0000h. when the count value matches d k1 , the counter generates the inttq0cck signal and asserts the toq0k pin. when the count value matches d 01 , the counter generates the inttq0cc0 signal, deasserts the toq0k pin, and stops counting. therefore, the counter may output a pulse with a delay period or ac tive period different from that of the one-shot pulse that is originally expected. remark m = 0 to 3, k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 408 (b) generation timing of compare match interrupt request signal (inttq0cck) the generation timing of the inttq0cck signal in the one-shot pulse out put mode is different from other mode inttq0cck signals; the inttq0cck signal is genera ted when the count val ue of the 16-bit counter matches the value of the tq0ccrk register. count clock 16-bit counter tq0ccrk register toq0k pin output inttq0cck signal d k d k ? 2d k ? 1d k d k + 1 d k + 2 usually, the inttq0cck signal is generated when the 16- bit counter counts up next time after its count value matches the value of the tq0ccrk register. in the one-shot pulse output mode, howe ver, it is generated one clock earlier. this is because the timing is changed to match the change timing of the toq0k pin. remark k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 409 8.6.5 pwm output mode (tq0md 2 to tq0md0 bits = 100) in the pwm output mode, a pwm waveform is output fr om the toq01 to toq03 pi ns when the tq0ctl0.tq0ce bit is set to 1. in addition, a square wave with a duty factor of 50% with the set value of the tq0ccr0 register + 1 as half its cycle is output from the toq00 pin. figure 8-28. configuration in pwm output mode ccr0 buffer register tq0ce bit tq0ccr0 register clear match signal inttq0cc0 signal toq03 pin inttq0cc3 signal toq00 pin note transfer s r tq0ccr1 register ccr1 buffer register match signal toq01 pin inttq0cc1 signal transfer transfer s r tq0ccr3 register ccr3 buffer register match signal transfer toq02 pin inttq0cc2 signal s r tq0ccr2 register ccr2 buffer register match signal 16-bit counter output controller (rs-ff) output controller output controller (rs-ff) output controller (rs-ff) tiq00 pin note (external event count input) internal count clock edge detector count clock selection note because the external event count input pin (t iq00) and timer output pin (toq00) share the same alternate-function pin, two functions cannot be used at the same time.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 410 figure 8-29. basic timing in pwm output mode d 0 d 1 d 2 d 3 d 1 d 2 d 3 d 0 d 0 d 1 d 2 d 3 d 0 d 1 d 2 d 3 d 0 d 1 d 2 d 3 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal toq00 pin output tq0ccr1 register inttq0cc1 signal toq01 pin output tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output active level width (d 3 ) cycle (d 0 + 1) cycle (d 0 + 1) cycle (d 0 + 1) cycle (d 0 + 1) active level width (d 3 ) active level width (d 3 ) active level width (d 3 ) active level width (d 1 ) active level width (d 1 ) active level width (d 1 ) active level width (d 1 ) active level width (d 2 ) active level width (d 2 ) active level width (d 2 ) active level width (d 2 )
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 411 when the tq0ce bit is set to 1, the 16-bit counter is cleared from ffffh to 0000h, starts counting, and outputs pwm waveform from the toq0k pin. the active level width, cycle, and duty factor of the pwm waveform can be calculated as follows. active level width = (set value of tq0ccrk register) count clock cycle cycle = (set value of tq0ccr0 register + 1) count clock cycle duty factor = (set value of tq0ccrk regist er)/(set value of tq0ccr0 register + 1) the pwm waveform can be changed by rewriting the tq0ccrm register while the counter is operating. the newly written value is reflected when the count value of the 16-bit counter matches the value of the ccr0 buffer register and the 16-bit counter is cleared to 0000h. the compare match interrupt request signal inttq0cc0 is generated when the 16-bit counter counts next time after its count value matches the value of the ccr0 buffer register, and the 16-bit counter is cleared to 0000h. the compare match interrupt request signal inttq0cck is ge nerated when the count value of the 16-bit counter matches the value of the ccrk buffer register. remark k = 1 to 3, m = 0 to 3 figure 8-30. setting of registers in pwm output mode (1/3) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 select count clock note 0: stop counting 1: enable counting 0/1 0/1 0/1 tq0cks2 tq0cks1 tq0cks0 tq0ce note the setting is invalid when the tq0ctl1.tq0eee bit = 1. (b) tmq0 control register 1 (tq0ctl1) 0 0 0/1 0 0 tq0ctl1 100 tq0md2 tq0md1 tq0md0 tq0eee tq0est 1, 0, 0: pwm output mode 0: operate on count clock selected by tq0cks0 to tq0cks2 bits 1: count external event input signal
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 412 figure 8-30. setting of registers in pwm output mode (2/3) (c) tmq0 i/o control register 0 (tq0ioc0) toq0k pin output 16-bit counter ? when tq0olk bit = 0 toq0k pin output 16-bit counter ? when tq0olk bit = 1 0/1 0/1 0/1 0/1 0/1 tq0ioc0 0: disable toq00 pin output 1: enable toq00 pin output setting of toq00 pin output level before count operation 0: low level 1: high level 0: disable toq01 pin output 1: enable toq01 pin output setting of toq01 pin output level before count operation 0: low level 1: high level 0/1 0/1 0/1 note tq0oe1 tq0ol0 tq0oe0 tq0ol1 tq0oe3 tq0ol2 tq0oe2 tq0ol3 setting of toq03 pin output level before count operation 0: low level 1: high level 0: disable toq02 pin output 1: enable toq02 pin output setting of toq02 pin output level before count operation 0: low level 1: high level 0: disable toq03 pin output 1: enable toq03 pin output note clear this bit to 0 when the toq00 pin is not used in the pwm output mode. (d) tmq0 i/o control register 2 (tq0ioc2) 0 0 0 0 0/1 tq0ioc2 select valid edge of external event count input (tiq00 pin). 0/1 0 0 tq0ees0 tq0ets1 tq0ets0 tq0ees1 (e) tmq0 counter read buffer register (tq0cnt) the value of the 16-bit counter can be read by reading the tq0cnt register.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 413 figure 8-30. register setting in pwm output mode (3/3) (f) tmq0 capture/compare register s 0 to 3 (tq0ccr0 and tq0ccr3) if d 0 is set to the tq0ccr0 register and d k to the tq0ccr1 register, the cycle and active level of the pwm waveform are as follows. cycle = (d 0 + 1) count clock cycle active level width = d k count clock cycle remarks 1. tmq0 i/o control register 1 (tq0ioc1) and tmq0 option register 0 (tq0opt0) are not used in the pwm output mode. 2. updating the tmq0 capture/ compare register 2 (tq0ccr2) and tmq0 capture/compare register 3 (tq0ccr3) is validated by writ ing the tmq0 capture/compare register 1 (tq0ccr1).
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 414 (1) operation flow in pwm output mode figure 8-31. software processing flow in pwm output mode (1/2) d 10 d 10 d 10 d 20 d 30 d 00 d 11 d 21 d 01 d 31 d 11 d 21 d 00 d 31 d 20 d 30 d 00 d 21 d 00 d 31 d 11 d 21 d 00 d 31 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register ccr0 buffer register inttq0cc0 signal toq00 pin output tq0ccr1 register ccr1 buffer register inttq0cc1 signal toq01 pin output tq0ccr2 register ccr2 buffer register inttq0cc2 signal toq02 pin output tq0ccr3 register ccr3 buffer register inttq0cc3 signal toq03 pin output d 00 d 01 d 00 d 00 d 01 d 00 d 10 d 11 d 10 d 10 d 11 d 10 d 11 d 10 d 11 d 11 d 20 d 21 d 20 d 21 d 20 d 21 d 21 d 30 d 31 d 30 d 31 d 30 d 31 d 30 d 31 <1> <2> <3> <4> <5> <6> <7> d 11 d 10 d 20
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 415 figure 8-31. software processing flow in pwm output mode (2/2) start <1> count operation start flow tq0ce bit = 1 register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc0 register, tq0ioc2 register, tq0ccr0 to tq0ccr3 registers initial setting of these registers is performed before setting the tq0ce bit to 1. only writing of the tq0ccr1 register must be performed when the set duty factor is only changed after writing the tq0ccr2 and tq0ccr3 registers. when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. writing the same value (same as the tq0ccr1 register already set) to the tq0ccr1 register is necessary only when the set duty factor of the toq02 and toq03 pin outputs is changed. when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. only writing of the tq0ccr1 register must be performed when the set duty factor is only changed. when counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. counting is stopped. the tq0cks0 to tq0cks2 bits can be set at the same time when counting is enabled (tq0ce bit = 1). writing of the tq0ccr1 register must be performed after writing the tq0ccr0, tq0ccr2, and tq0ccr3 registers. when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer registers. writing the same value (same as the tq0ccr1 register already set) to the tq0ccr1 register is necessary only when the set cycle is changed. <2> tq0ccr0 to tq0ccr3 register setting change flow <3> tq0ccr0 register setting change flow <4> tq0ccr1 to tq0ccr3 register setting change flow <5> tq0ccr2 and tq0ccr3 register setting change flow <6> tq0ccr1 register setting change flow <7> count operation stop flow tq0ce bit = 0 setting of tq0ccr2, tq0ccr3 registers setting of tq0ccr1 register setting of tq0ccr2, tq0ccr3 registers setting of tq0ccr1 register stop setting of tq0ccr1 register setting of tq0ccr0 register setting of tq0ccr1 register setting of tq0ccr0, tq0ccr2, and tq0ccr3 registers tq0ccr1 register when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 416 (2) pwm output mode operation timing (a) changing pulse width during operation to change the pwm waveform while the counter is operating, write the tq0ccr1 register last. rewrite the tq0ccrm register after writing the tq 0ccr1 register after the inttq0cc1 signal is detected. ffffh 16-bit counter 0000h tq0ce bit d 30 d 00 d 01 d 30 d 30 d 20 d 20 d 20 d 21 d 11 d 00 d 00 d 31 d 01 d 01 d 21 d 11 d 31 tq0ccr0 register ccr0 buffer register inttq0cc0 signal tq0ccr1 register ccr1 buffer register inttq0cc1 signal toq01 pin output tq0ccr2 register ccr2 buffer register inttq0cc2 signal toq02 pin output tq0ccr3 register ccr3 buffer register inttq0cc3 signal toq03 pin output toq00 pin output d 10 d 10 d 10 d 00 d 11 d 10 d 11 d 10 d 21 d 20 d 21 d 20 d 31 d 30 d 31 d 30 d 00 d 01
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 417 to transfer data from the tq0ccrm register to the ccrm buffer register, the tq0ccr1 register must be written. to change both the cycle and active level of the pwm waveform at this time, first set the cycle to the tq0ccr0 register, set the active level width to t he tq0ccr2 and tq0ccr3 registers, and then set an active level width to the tq0ccr1 register. to change only the cycle of the pwm waveform, first set the cycle to the tq0ccr0 register, and then write the same value (same as the tq0ccr1 regist er already set) to the tq0ccr1 register. to change only the active level width (duty factor) of pwm wave, first set the active level to the tq0ccr2 and tq0ccr3 registers, and then set an active level to the tq0ccr1 register. to change only the active level width (duty factor) of the pwm waveform output by the toq01 pin, only the tq0ccr1 register has to be set. to change only the active level width (duty factor) of the pwm waveform output by the toq02 and toq03 pins, first set an active level width to the tq0 ccr2 and tq0ccr3 registers, and then write the same value (same as the tq0ccr1 register already set) to the tq0ccr1 register. after the tq0ccr1 register is written, the value wr itten to the tq0ccrm register is transferred to the ccrm buffer register in synchronization with the timi ng of clearing the 16-bit counter, and is used as a value to be compared with the value of the 16-bit counter. to change only the cycle of the pwm waveform, first set a cycle to the tq0ccr0 register, and then write the same value to the tq0ccr1 register. to write the tq0ccr0 to tq0ccr3 registers again afte r writing the tq0ccr1 register once, do so after the inttq0cc0 signal is generated. otherwise, t he value of the ccrm buffer register may become undefined because the timing of transferring data from the tq0ccrm register to the ccrm buffer register conflicts with writing the tq0ccrm register. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 418 (b) 0%/100% output of pwm waveform to output a 0% waveform, set the tq0ccrk register to 0000h. the 16-bit counter is cleared to 0000h and the inttq0cc0 and intq0cck signals are generated at the timing following the clock in which the count value of the 16-bit counter matches the value of the ccr0 buffer register. count clock 16-bit counter tq0ce bit tq0ccr0 register tq0ccrk register inttq0cc0 signal inttq0cck signal toq0k pin output d 0 0000h d 0 0000h d 0 0000h d 0 ? 1d 0 0000 ffff 0000 d 0 ? 1d 0 0000 0001 remark k = 1 to 3 to output a 100% waveform, set a value of (set value of tq0ccr0 register + 1) to the tq0ccrk register. if the set value of the tq0ccr0 register is ffffh, 100% output cannot be produced. count clock 16-bit counter tq0ce bit tq0ccr0 register tq0ccrk register inttq0cc0 signal inttq0cck signal toq0k pin output d 0 d 0 + 1 d 0 d 0 + 1 d 0 d 0 + 1 d 0 ? 1d 0 0000 ffff 0000 d 0 ? 1d 0 0000 0001 l remark k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 419 (c) generation timing of compare match interrupt request signal (inttq0cck) the timing of generation of the inttq0cck signal in the pwm output mode differs from the timing of other mode inttq0cck signals; the inttq0cck signal is genera ted when the count val ue of the 16-bit counter matches the value of the tq0ccrk register. count clock 16-bit counter ccrk buffer register toq0k pin output inttq0cck signal d k d k ? 2d k ? 1d k d k + 1 d k + 2 remark k = 1 to 3 usually, the inttq0cck signal is generated in synch ronization with the next counting up after the count value of the 16-bit counter matches the value of the tq0ccrk register. in the pwm output mode, however, it is generated one clock earlier. this is because the timing is changed to match the change timing of the output signal of the toq0k pin.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 420 8.6.6 free-running timer mode (t q0md2 to tq0md0 bits = 101) in the free-running timer mode, 16-bit timer/event counter q starts counting when the tq0ctl0.tq0ce bit is set to 1. at this time, the tq0ccrm register can be used as a compare register or a captur e register, depending on the setting of the tq0opt0.tq0ccsm bit. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 421 figure 8-32. configuration in free-running timer mode toq03 pin note 2 toq02 pin note 2 toq01 pin note 2 toq00 pin note 1 inttq0ov signal tq0ccsm bit (capture/compare selection) inttq0cc3 signal inttq0cc2 signal inttq0cc1 signal inttq0cc0 signal tiq03 pin note 2 (capture trigger input) tq0ccr3 register (capture) tiq00 pin note 1 (external event count input/ capture trigger input) internal count clock tq0ce bit tiq01 pin note 2 (capture trigger input) tiq02 pin note 2 (capture trigger input) tq0ccr0 register (capture) tq0ccr1 register (capture) tq0ccr2 register (capture) tq0ccr3 register (compare) tq0ccr2 register (compare) tq0ccr1 register (compare) 0 1 0 1 0 1 0 1 16-bit counter tq0ccr0 register (compare) output controller output controller output controller output controller count clock selection edge detector edge detector edge detector edge detector edge detector notes 1. because the external event count input pin (t iq00), capture trigger in put pin (tiq00), and timer output pin (toq00) share the same alternate-function pin, two or more functions cannot be used at the same time. 2. because the capture trigger input pin (tiq0k) and timer output pin (toq0k) share the same alternate-function pin, two functions cannot be used at the same time (k = 1 to 3).
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 422 ? compare operation when the tq0ce bit is set to 1, 16-bit timer/event co unter q starts counting, an d the output signals of the toq00 to toq03 pins are inverted. when the count value of the 16-bit count er later matches the set value of the tq0ccrm register, a compare match interrupt r equest signal (inttq0ccm) is generated, and the output signal of the toq0m pin is inverted. the 16-bit counter continues counting in synchronization with the count clock. when it counts up to ffffh, it generates an overflow interrupt request signal (inttq0ov) at the next clock, is cleared to 0000h, and continues counting. at this time, the overflow flag (tq0opt0.tq0ovf bit) is also set to 1. confirm that the overflow flag is set to 1 and then clear it to 0 by ex ecuting the clr instruction via software. the tq0ccrm register can be rewritten while the counter is operating. if it is rewritten, the new value is reflected immediately and compared with the count value. remark m = 0 to 3 figure 8-33. basic timing in free-r unning timer mode (compare function) d 10 d 20 d 30 d 00 d 20 d 31 d 31 d 30 d 00 d 11 d 11 d 21 d 01 d 11 d 21 d 01 cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction ffffh 16-bit counter 0000h toq01 pin output tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output inttq0ov signal tq0ovf bit toq00 pin output tq0ccr1 register inttq0cc1 signal tq0ce bit tq0ccr0 register inttq0cc0 signal d 00 d 01 d 11 d 10 d 21 d 20 d 31 d 30
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 423 ? capture operation when the tq0ce bit is set to 1, the 16-bit counter starts counting. when the valid edge input to the tiq0m pin is detected, the count valu e of the 16-bit counter is stored in t he tq0ccrm register, and a capture interrupt request signal (inttq0ccm) is generated. the 16-bit counter continues counting in synchronization with the count clock. when it counts up to ffffh, it generates an overflow interrupt request signal (inttq0ov) at the next clock, is cleared to 0000h, and continues counting. at this time, the overflow flag (tq0opt0.tq0ovf bit) is also set to 1. confirm that the overflow flag is set to 1 and then clear it to 0 by ex ecuting the clr instruction via software. remark m = 0 to 3 figure 8-34. basic timing in free-r unning timer mode (capture function) d 20 d 00 d 30 d 10 d 11 d 21 d 31 d 12 d 01 d 02 d 22 d 32 d 03 d 13 d 33 d 23 0000 d 00 d 01 d 02 d 03 0000 d 10 d 11 d 12 d 13 0000 d 20 d 21 d 23 d 22 0000 d 30 d 31 d 32 d 33 cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction ffffh 16-bit counter 0000h tiq02 pin input tq0ccr2 register inttq0cc2 signal tiq03 pin input tq0ccr3 register inttq0cc3 signal inttq0ov signal tq0ovf bit tiq01 pin input tq0ccr1 register inttq0cc1 signal tq0ce bit tiq00 pin input tq0ccr0 register inttq0cc0 signal
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 424 figure 8-35. register setting in free-running timer mode (1/3) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 select count clock note 0: stop counting 1: enable counting 0/1 0/1 0/1 tq0cks2 tq0cks1 tq0cks0 tq0ce note the setting is invalid when the tq0ctl1.tq0eee bit = 1 (b) tmq0 control register 1 (tq0ctl1) 0 0 0/1 0 0 tq0ctl1 101 tq0md2 tq0md1 tq0md0 tq0eee tq0est 1, 0, 1: free-running timer mode 0: operate with count clock selected by tq0cks0 to tq0cks2 bits 1: count on external event count input signal (c) tmq0 i/o control register 0 (tq0ioc0) 0/1 0/1 0/1 0/1 0/1 tq0ioc0 0: disable toq00 pin output 1: enable toq00 pin output 0: disable toq01 pin output 1: enable toq01 pin output setting of output level before toq01 pin count operation 0: low level 1: high level 0/1 0/1 0/1 tq0oe1 tq0ol0 tq0oe0 tq0ol1 tq0oe3 tq0ol2 tq0oe2 tq0ol3 setting of output level before toq03 pin count operation 0: low level 1: high level 0: disable toq02 pin output 1: enable toq02 pin output setting of output level before toq02 pin count operation 0: low level 1: high level 0: disable toq03 pin output 1: enable toq03 pin output setting of output level before toq00 pin count operation 0: low level 1: high level
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 425 figure 8-35. register setting in free-running timer mode (2/3) (d) tmq0 i/o control register 1 (tq0ioc1) 0/1 0/1 0/1 0/1 0/1 tq0ioc1 select valid edge of tiq00 pin input note select valid edge of tiq01 pin input 0/1 0/1 0/1 tq0is2 tq0is1 tq0is0 tq0is3 tq0is6 tq0is5 tq0is4 tq0is7 select valid edge of tiq02 pin input select valid edge of tiq03 pin input note set the valid edge selection of the unused alternat e external input signals to ?no edge detection?. (e) tmq0 i/o control register 2 (tq0ioc2) 0 0 0 0 0/1 tq0ioc2 select valid edge of external event count input (tiq00 pin) note 0/1 0 0 tq0ees0 tq0ets1 tq0ets0 tq0ees1 note set the valid edge selection of the unused alternat e external input signals to ?no edge detection?. (f) tmq0 option register 0 (tq0opt0) 0/1 0/1 0/1 0/1 0 tq0opt0 overflow flag specifies if tq0ccr0 register functions as capture or compare register 0: compare register 1: capture register specifies if tq0ccr1 register functions as capture or compare register 0: compare register 1: capture register 0 0 0/1 tq0ccs0 tq0ovf tq0ccs1 tq0ccs2 tq0ccs3 specifies if tq0ccr2 register functions as capture or compare register 0: compare register 1: capture register specifies if tq0ccr3 register functions as capture or compare register 0: compare register 1: capture register
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 426 figure 8-35. register setting in free-running timer mode (3/3) (g) tmq0 counter read buffer register (tq0cnt) the value of the 16-bit counter can be read by reading the tq0cnt register. (h) tmq0 capture/compare regist ers 0 to 3 (tq0ccr0 to tq0ccr3) these registers function as captur e registers or compare registers depending on the setting of the tq0opt0.tq0ccsm bit. when the registers function as captur e registers, they store the count value of the 16-bit counter when the valid edge input to the tiq0m pin is detected. when the registers function as compare registers and when d m is set to the tq0ccrm register, the inttq0ccm signal is generated when the counter reaches (d m + 1), and the output signal of the toq0m pin is inverted. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 427 (1) operation flow in free-running timer mode (a) when using capture/compare register as compare register figure 8-36. software processing flow in fr ee-running timer mode (c ompare function) (1/2) d 10 d 20 d 30 d 00 d 10 d 20 d 30 d 00 d 11 d 31 d 01 d 21 d 21 d 11 d 11 d 31 d 01 d 00 d 10 d 20 d 30 d 01 d 11 d 21 d 31 cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction <3> <1> <2> <2> <2> ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal toq00 pin output tq0ccr1 register inttq0cc1 signal toq01 pin output tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output inttq0ov signal tq0ovf bit
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 428 figure 8-36. software processing flow in fr ee-running timer mode (c ompare function) (2/2) tq0ce bit = 1 read tq0opt0 register (check overflow flag). register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc0 register, tq0ioc2 register, tq0opt0 register, tq0ccr0 to tq0ccr3 registers initial setting of these registers is performed before setting the tq0ce bit to 1. the tq0cks0 to tq0cks2 bits can be set at the same time when counting has been started (tq0ce bit = 1). start execute instruction to clear tq0ovf bit (clr tq0ovf). <1> count operation start flow <2> overflow flag clear flow tq0ce bit = 0 counter is initialized and counting is stopped by clearing tq0ce bit to 0. stop <3> count operation stop flow tq0ovf bit = 1 no yes
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 429 (b) when using capture/compare register as capture register figure 8-37. software processing flow in fr ee-running timer mode (c apture function) (1/2) d 20 d 00 d 30 d 10 d 11 d 21 d 31 d 12 d 01 d 02 d 22 d 32 d 03 d 13 d 33 d 23 0000 d 00 d 01 d 02 d 03 0000 0000 0000 0000 0000 d 10 d 11 d 12 d 13 0000 d 20 d 21 d 23 d 22 0000 d 30 d 31 d 32 d 33 cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction <3> <1> <2> <2> <2> ffffh 16-bit counter 0000h tq0ce bit tiq02 pin input tq0ccr2 register inttq0cc2 signal tiq03 pin input tq0ccr3 register inttq0cc3 signal inttq0ov signal tq0ovf bit tiq01 pin input tq0ccr1 register inttq0cc1 signal tiq00 pin input tq0ccr0 register inttq0cc0 signal
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 430 figure 8-37. software processing flow in fr ee-running timer mode (c apture function) (2/2) tq0ce bit = 1 read tq0opt0 register (check overflow flag). register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc1 register, tq0opt0 register initial setting of these registers is performed before setting the tq0ce bit to 1. the tq0cks0 to tq0cks2 bits can be set at the same time when counting has been started (tq0ce bit = 1). start execute instruction to clear tq0ovf bit (clr tq0ovf). <1> count operation start flow <2> overflow flag clear flow tq0ce bit = 0 counter is initialized and counting is stopped by clearing tq0ce bit to 0. stop <3> count operation stop flow tq0ovf bit = 1 no yes
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 431 (2) operation timing in free-running timer mode (a) interval operation with compare register when 16-bit timer/event counter q is used as an in terval timer with the tq0ccrm register used as a compare register, software processing is necessary for setting a comparison value to generate the next interrupt request signal each time t he inttq0ccm signal has been detected. remark m = 0 to 3 d 00 d 10 d 20 d 01 d 30 d 12 d 03 d 22 d 31 d 21 d 23 d 02 d 13 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal toq00 pin output tq0ccr1 register inttq0cc1 signal toq01 pin output tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output interval period (d 00 + 1) interval period (10000h + d 02 ? d 01 ) interval period (d 01 ? d 00 ) interval period (d 03 ? d 02 ) interval period (d 04 ? d 03 ) d 00 d 01 d 02 d 03 d 04 d 05 interval period (d 10 + 1) interval period (10000h + d 12 ? d 11 ) interval period (d 11 ? d 10 ) interval period (d 13 ? d 12 ) d 10 d 11 d 12 d 13 d 14 interval period (d 20 + 1) interval period (10000h + d 21 ? d 20 ) interval period (10000h + d 23 ? d 22 ) interval period (d 22 ? d 21 ) interval period (d 30 + 1) interval period (10000h + d 31 ? d 30) d 20 d 21 d 22 d 23 d 31 d 30 d 32 d 04 d 11
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 432 when performing an interval operation in the free-running timer mode, two intervals can be set with one channel. to perform the interval operation, the value of the co rresponding tq0ccrm register must be re-set in the interrupt servicing that is executed when the inttq0ccm signal is detected. the set value for re-setting the tq0ccrm register c an be calculated by the following expression, where ?d m ? is the interval period. compare register default value: d m ? 1 value set to compare register second and subsequent time: previous set value + d m (if the calculation result is greate r than ffffh, subtract 10000h from the result and set this value to the register.) remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 433 (b) pulse width measurement with capture register when pulse width measurement is performed with the tq0ccrm register used as a capture register, software processing is necessary for reading the capt ure register each time the inttq0ccm signal has been detected and for calculating an interval. remark m = 0 to 3 d 20 d 00 d 30 d 10 d 11 d 21 d 31 d 12 d 01 d 02 d 32 d 13 d 03 d 22 d 33 d 23 0000 pulse interval (10000h + d 01 ? d 00 ) pulse interval (10000h + d 02 ? d 01 ) pulse interval (10000h + d 03 ? d 02 ) d 00 d 01 d 02 d 03 pulse interval (d 00 + 1) 0000 pulse interval (10000h + d 11 ? d 10 ) pulse interval (10000h + d 12 ? d 11 ) pulse interval (d 13 ? d 12 ) d 10 d 11 d 12 d 13 pulse interval (d 10 + 1) 0000 pulse interval (10000h + d 21 ? d 20 ) pulse interval (20000h + d 22 ? d 21 ) pulse interval (d 23 ? d 22 ) d 20 d 21 d 23 d 22 pulse interval (d 20 + 1) 0000 pulse interval (10000h + d 31 ? d 30 ) pulse interval (10000h + d 32 ? d 31 ) pulse interval (10000h + d 33 ? d 32 ) d 30 d 31 d 32 d 33 pulse interval (d 30 + 1) cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction ffffh 16-bit counter 0000h tq0ce bit tiq00 pin input tq0ccr0 register inttq0cc0 signal tiq02 pin input tq0ccr2 register inttq0cc2 signal tiq03 pin input tq0ccr3 register inttq0cc3 signal inttq0ov signal tq0ovf bit tiq01 pin input tq0ccr1 register inttq0cc1 signal
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 434 when executing pulse width measurement in the fr ee-running timer mode, four pulse widths can be measured with one channel. to measure a pulse width, the pu lse width can be calculated by re ading the value of the tq0ccrm register in synchronization with the inttq0ccm si gnal, and calculating the difference between the read value and the previously read value. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 435 (c) processing of overflow when two or more capture registers are used care must be exercised in processing the overflow flag when two capture registers are used. first, an example of incorrect processing is shown below. example of incorrect processing when tw o or more capture registers are used ffffh 16-bit counter 0000h tq0ce bit tiq00 pin input tq0ccr0 register tiq01 pin input tq0ccr1 register inttq0ov signal tq0ovf bit d 00 d 01 d 10 d 11 d 10 <1> <2> <3> <4> d 00 d 11 d 01 the following problem may occur when two pulse widt hs are measured in the free-running timer mode. <1> read the tq0ccr0 register (setting of t he default value of t he tiq00 pin input). <2> read the tq0ccr1 register (setting of t he default value of t he tiq01 pin input). <3> read the tq0ccr0 register. read the overflow flag. if the overflow flag is 1, clear it to 0. because the overflow flag is 1, the pulse width can be calculated by (10000h + d 01 ? d 00 ). <4> read the tq0ccr1 register. read the overflow flag. because the flag is cleared in <3>, 0 is read. because the overflow flag is 0, the pulse width can be calculated by (d 11 ? d 10 ) (incorrect). when two capture registers are used, and if the overflow flag is cleared to 0 by one capture register, the other capture register may not obtain the correct pulse width. use software when using two capture registers. an example of how to use software is shown below.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 436 (1/2) example when two capture registers are used (usi ng overflow interrupt) ffffh 16-bit counter 0000h tq0ce bit inttq0ov signal tq0ovf bit tq0ovf0 flag note tiq00 pin input tq0ccr0 register tq0ovf1 flag note tiq01 pin input tq0ccr1 register d 10 d 11 d 00 d 01 d 10 <1> <2> <5> <6> <3> <4> d 00 d 11 d 01 note the tq0ovf0 and tq0ovf1 flags are set on the internal ram by software. <1> read the tq0ccr0 register (setting of t he default value of t he tiq00 pin input). <2> read the tq0ccr1 register (setting of t he default value of t he tiq01 pin input). <3> an overflow occurs. set the tq0ovf0 and tq0ovf1 flags to 1 in the overflow interrupt servicing, and clear the overflow flag to 0. <4> read the tq0ccr0 register. read the tq0ovf0 flag. if the tq0o vf0 flag is 1, clear it to 0. because the tq0ovf0 flag is 1, the pulse width can be calculated by (10000h + d 01 ? d 00 ). <5> read the tq0ccr1 register. read the tq0ovf1 flag. if the tq0ovf1 flag is 1, clear it to 0 (the tq0ovf0 flag is cleared in <4>, and the tq0ovf1 flag remains 1). because the tq0ovf1 flag is 1, the pulse width can be calculated by (10000h + d 11 ? d 10 ) (correct). <6> same as <3>
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 437 (2/2) example when two capture re gisters are used (without using overflow interrupt) ffffh 16-bit counter 0000h tq0ce bit inttq0ov signal tq0ovf bit tq0ovf0 flag note tiq00 pin input tq0ccr0 register tq0ovf1 flag note tiq01 pin input tq0ccr1 register d 10 d 11 d 00 d 01 d 10 <1> <2> <5> <6> <3> <4> d 00 d 11 d 01 l note the tq0ovf0 and tq0ovf1 flags are set on the internal ram by software. <1> read the tq0ccr0 register (setting of t he default value of t he tiq00 pin input). <2> read the tq0ccr1 register (setting of t he default value of t he tiq01 pin input). <3> an overflow occurs. nothing is done by software. <4> read the tq0ccr0 register. read the overflow flag. if the overflow flag is 1, set only the tq0ovf1 flag to 1, and clear the overflow flag to 0. because the overflow flag is 1, the pulse width can be calculated by (10000h + d 01 ? d 00 ). <5> read the tq0ccr1 register. read the overflow flag. because the overflow flag is cleared in <4>, 0 is read. read the tq0ovf1 flag. if the tq0o vf1 flag is 1, clear it to 0. because the tq0ovf1 flag is 1, the pulse width can be calculated by (10000h + d 11 ? d 10 ) (correct). <6> same as <3>
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 438 (d) processing of overflow if capture trigger interval is long if the pulse width is greater than one cycle of the 16- bit counter, care must be exercised because an overflow may occur more than once from the first captur e trigger to the next. first, an example of incorrect processing is shown below. example of incorrect processing when capture trigger interval is long ffffh 16-bit counter 0000h tq0ce bit tiq0m pin input tq0ccrm register inttq0ov signal tq0ovf bit d m0 d m1 d m0 d m1 <1> <2> <3> <4> 1 cycle of 16-bit counter pulse width the following problem may occur when a long pulse width in the free-running timer mode. <1> read the tq0ccrm register (setting of t he default value of the tiq0m pin input). <2> an overflow occurs. nothing is done by software. <3> an overflow occurs a second time. nothing is done by software. <4> read the tq0ccrm register. read the overflow flag. if the overflow flag is 1, clear it to 0. because the overflow flag is 1, the pul se width can be calculated by (10000h + d m1 ? d m0 ) (incorrect). actually, the pulse width must be (20000h + d m1 ? d m0 ) because an overflow occurs twice. remark m = 0 to 3 if an overflow occurs twice or more when the capture tr igger interval is long, the correct pulse width may not be obtained. if the capture trigger interval is long, slow the count clock to lengthen one cycle of the 16-bit counter, or use software. an example of how to use software is shown next.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 439 example when capture trigger interval is long ffffh 16-bit counter 0000h tq0ce bit tiq0m pin input tq0ccrm register inttq0ov signal tq0ovf bit overflow counter note d m0 d m1 1h 0h 2h 0h d m0 d m1 <1> <2> <3> <4> 1 cycle of 16-bit counter pulse width note the overflow counter is set arbitrarily by software on the internal ram. <1> read the tq0ccrm register (setting of t he default value of the tiq0m pin input). <2> an overflow occurs. increment the overflow count er and clear the overflow flag to 0 in the overflow interrupt servicing. <3> an overflow occurs a second time. increment (+1) the overflow counter and clear the overflow flag to 0 in the overflow interrupt servicing. <4> read the tq0ccrm register. read the overflow counter. when the overflow counter is ?n?, t he pulse width can be calculated by (n 10000h + d m1 ? d m0 ). in this example, the pulse width is (20000h + d m1 ? d m0 ) because an overflow occurs twice. clear the overflow counter (0h). remark m = 0 to 3 (e) clearing overflow flag the overflow flag can be cleared to 0 by clearing th e tq0ovf bit to 0 with t he clr instruction after reading tq0ovf bit = 1 and by writing 8-bit data (bit 0 is 0) to the tq0opt 0 register after reading tq0ovf bit = 1.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 440 (3) note on capture operation if the capture operation is used and if a slow clock is selected as the count clock, ffffh, not 0000h, may be captured to the tq0ccrm register if the capture trigger is input immedi ately after the tq0ctl0.tq0ce bit is set to 1 (m = 0 to 3). count clock 0000h ffffh tq0ce bit tq0ccr0 register ffffh 0001h 0000h tiq00 pin input capture trigger input 16-bit counter sampling clock capture trigger input
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 441 8.6.7 pulse width measurement mode (tq0md2 to tq0md0 bits = 110) in the pulse width measurement mode, 16-bit timer/even t counter q starts counting when the tq0ctl0.tq0ce bit is set to 1. each time the valid edge input to the tiq0m pi n has been detected, t he count value of t he 16-bit counter is stored in the tq0ccrm register, and the 16-bit counter is cleared to 0000h. the interval of the valid edge can be measured by reading the tq0ccrm register after a capture interrupt request signal (inttq0ccm) occurs. in case of figure 8-39 , select either of the tiq00 to tiq03 pins as the capture trigger input pin. specify ?no edge detected? by using the tq0ioc1 register for the unused pins. remark m = 0 to 3 k = 1 to 3 figure 8-38. configuration in pulse width measurement mode inttq0ov signal inttq0cc0 signal inttq0cc1 signal inttq0cc2 signal inttq0cc3 signal tiq03 pin (capture trigger input) tq0ccr3 register (capture) tiq00 pin (capture trigger input) tq0ce bit tiq01 pin (capture trigger input) tiq02 pin (capture trigger input) tq0ccr0 register (capture) tq0ccr1 register (capture) tq0ccr2 register (capture) 16-bit counter clear edge detector edge detector edge detector edge detector count clock selection caution in the pulse widt h measurement mode, select the intern al clock (set the tq0ctl1.tq0eee bit = 0) as the count clock.
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 442 figure 8-39. basic timing in pulse width measurement mode ffffh 16-bit counter 0000h tq0ce bit tiq0m pin input tq0ccrm register inttq0ccm signal inttq0ov signal tq0ovf bit d 0 0000h d 1 d 2 d 3 cleared to 0 by clr instruction remark m = 0 to 3 when the tq0ce bit is set to 1, the 16-bit counter starts c ounting. when the valid edge input to the tiq0m pin is later detected, the count value of the 16-bit counter is stored in the tq0ccrm register, the 16-bit counter is cleared to 0000h, and a capture interrupt request signal (inttq0ccm) is generated. the pulse width is calculated as follows. pulse width = captured value count clock cycle if the valid edge is not input to the tiq0m pin even when the 16-bit counter coun ted up to ffffh, an overflow interrupt request signal (inttq0ov) is generated at the next c ount clock, and the counter is cleared to 0000h and continues counting. at this time, the overflow flag (tq0opt0.t q0ovf bit) is also set to 1. clear the overflow flag to 0 by executing the clr instruction via software. if the overflow flag is set to 1, the pu lse width can be calculated as follows. pulse width = (10000h tq0ovf bit set (1) count + captured value) count clock cycle remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 443 figure 8-40. register setting in pu lse width measurement mode (1/2) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 select count clock 0: stop counting 1: enable counting 0/1 0/1 0/1 tq0cks2 tq0cks1 tq0cks0 tq0ce (b) tmq0 control register 1 (tq0ctl1) 00000 tq0ctl1 110 tq0md2 tq0md1 tq0md0 tq0eee tq0est 1, 1, 0: pulse width measurement mode 0: operate with count clock selected by tq0cks0 to tq0cks2 bits (c) tmq0 i/o control register 1 (tq0ioc1) 0/1 0/1 0/1 0/1 0/1 tq0ioc1 select valid edge of tiq00 pin input select valid edge of tiq01 pin input 0/1 0/1 0/1 tq0is2 tq0is1 tq0is0 tq0is3 tq0is6 tq0is5 tq0is4 tq0is7 select valid edge of tiq02 pin input select valid edge of tiq03 pin input
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 444 figure 8-40. register setting in pu lse width measurement mode (2/2) (d) tmq0 option register 0 (tq0opt0) 00000 tq0opt0 overflow flag 0 0 0/1 tq0ccs0 tq0ovf tq0ccs1 tq0ccs2 tq0ccs3 (e) tmq0 counter read buffer register (tq0cnt) the value of the 16-bit counter can be read by reading the tq0cnt register. (f) tmq0 capture/compare register s 0 to 3 (tq0ccr0 to tq0ccr3) these registers store the count va lue of the 16-bit counter when the valid edge input to the tiq0m pin is detected. remarks 1. tmq0 i/o control register 0 (tq0ioc0) and tmq0 i/o control register 2 (tq0ioc2) are not used in the pulse width measurement mode. 2. m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 445 (1) operation flow in pul se width measurement mode figure 8-41. software processing flow in pulse width measurement mode tq0ce bit = 1 tq0ce bit = 0 register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits), tq0ctl1 register, tq0ioc1 register, tq0opt0 register initial setting of these registers is performed before setting the tq0ce bit to 1. the tq0cks0 to tq0cks2 bits can be set at the same time when counting has been started (tq0ce bit = 1). the counter is initialized and counting is stopped by clearing the tq0ce bit to 0. start stop <1> count operation start flow <2> count operation stop flow <1> <2> ffffh 16-bit counter 0000h tq0ce bit tiq00 pin input tq0ccr0 register inttq0cc0 signal d 0 0000h 0000h d 1 d 2
chapter 8 16-bit timer/event counter q (tmq) user?s manual u16603ej5v1ud 446 (2) operation timing in pul se width measurement mode (a) clearing overflow flag the overflow flag can be cleared to 0 by clearing th e tq0ovf bit to 0 with t he clr instruction after reading the tq0ovf bit when it is 1 and by writing 8-bi t data (bit 0 is 0) to t he tq0opt0 register after reading the tq0ovf bit when it is 1. (3) note if a slow clock is selected as the count clock, ffffh, not 0000h, may be captured to the tq0ccrm register if the capture trigger is input immediately after t he tq0ctl0.tq0ce bit is set to 1 (m = 0 to 3). 0000h ffffh ffffh 0002h 0000h capture trigger input capture trigger input count clock tq0ce bit tq0ccr0 register tiq00 pin input 16-bit counter sampling clock 8.7 selector function for the selector function, see 7.7 selector function .
user?s manual u16603ej5v1ud 447 chapter 9 16-bit interval timer m (tmm) timer m (tmm) is a 16-bit interval timer. the v850es/sj2 and v850es/sj2-h incorporate tmm0. 9.1 overview the tmm0 has the following functions. ? interval function ? 8 clocks selectable ? 16-bit counter 1 (the 16-bit counter cannot be read during timer count operation.) ? compare register 1 (the compare register cannot be written during timer count operation.) ? compare match interrupt 1 timer m supports only the clear & start mode. t he free-running timer mode is not supported.
chapter 9 16-bit interval timer m (tmm) user?s manual u16603ej5v1ud 448 9.2 configuration tmm0 includes the following hardware. table 9-1. configuration of tmm0 item configuration timer register 16-bit counter register tmm0 compare register 0 (tm0cmp0) control register tmm0 control register 0 (tm0ctl0) figure 9-1. block diagram of tmm0 tm0ctl0 internal bus f xx f xx /2 f xx /4 f xx /64 f xx /512 intwt f r /8 f xt controller 16-bit counter match clear inttm0eq0 tm0cmp0 tm0ce tm0cks2 tm0cks1tm0cks0 selector remark f xx : main clock frequency f r : internal oscillation clock frequency f xt : subclock frequency intwt: watch timer interrupt request signal (1) 16-bit counter this is a 16-bit counter that counts the internal clock. the 16-bit counter cannot be read or written. (2) tmm0 compare register 0 (tm0cmp0) the tm0cmp0 register is a 16-bit compare register. this register can be read or written in 16-bit units. reset input clears this register to 0000h. the same value can always be written to the tm0cmp0 register by software. during the tmm0 operation (tm0ctl0.tm0ce bit = 1), rewriting the tm0cmp0 register is prohibited. tm0cmp0 12108642 after reset: 0000h r/w address: fffff694h 14 0 13119753 15 1
chapter 9 16-bit interval timer m (tmm) user?s manual u16603ej5v1ud 449 9.3 register (1) tmm0 control register 0 (tm0ctl0) the tm0ctl0 register is an 8-bit regist er that controls the tmm0 operation. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. the same value can always be written to the tm0ctl0 register by software. tm0ce tmm0 operation disabled (16-bit counter reset asynchronously). operation clock application stopped. tmm0 operation enabled. operation clock application started. tmm0 operation started. tm0ce 0 1 internal clock operation enable/disable specification tm0ctl0 0 0 0 0 tm0cks2 tm0cks1 tm0cks0 654321 after reset: 00h r/w address: fffff690h the internal clock control and internal circuit reset for tmm0 are performed asynchronously with the tm0ce bit. when the tm0ce bit is cleared to 0, the internal clock of tmm0 is disabled (fixed to low level) and 16-bit counter is reset asynchronously. <7> 0 f xx f xx /2 f xx /4 f xx /64 f xx /512 intwt f r /8 f xt tm0cks2 0 0 0 0 1 1 1 1 count clock selection tm0cks1 0 0 1 1 0 0 1 1 tm0cks0 0 1 0 1 0 1 0 1 cautions 1. set the tm0cks2 to tm 0cks0 bits when tm0ce bit = 0. when changing the value of tm0ce from 0 to 1, it is not possible to set the value of the tm0cks2 to tm0cks0 bits simultaneously. 2. be sure to clear bits 3 to 6 to ?0?. remark f xx : main clock frequency f r : internal oscillation clock frequency f xt : subclock frequency
chapter 9 16-bit interval timer m (tmm) user?s manual u16603ej5v1ud 450 9.4 operation caution do not set the tm0cmp0 register to ffffh. 9.4.1 interval timer mode in the interval timer mode, an interrupt request signal (inttm0eq0) is generated at the interval set by the tm0cm0p register if the tm0ctl0.tm0ce bit is set to 1. figure 9-2. configuration of interval timer 16-bit counter tm0cmp0 register tm0ce bit count clock selection clear match signal inttm0eq0 signal figure 9-3. basic timing of operation in interval timer mode d 0 d 0 d 0 d 0 d 0 interval (d 0 + 2) interval (d 0 + 1) interval (d 0 + 1) interval (d 0 + 1) ffffh 16-bit counter 0000h tm0ce bit tm0cmp0 register inttm0eq0 signal when the tm0ce bit is set to 1, the value of the 16-bit counter is cleared from ffffh to 0000h in synchronization with the count clock, and the c ounter starts counting. when the count value of the 16-bit counter matches the value of the tm0cmp0 register, the 16-bit counter is cleared to 0000h and a compare match interrupt request signal (inttm0eq0) is generated. the interval can be calculated by the following expression. interval = (set value of tm0cmp0 register + 1) count clock cycle
chapter 9 16-bit interval timer m (tmm) user?s manual u16603ej5v1ud 451 figure 9-4. register setting for interval timer mode operation (a) tmm0 control register 0 (tm0ctl0) 0/1 0 0 0 0 tm0ctl0 0/1 0/1 0/1 tm0cks2 tm0cks1 tm0cks0 tm0ce 0: stop counting 1: enable counting select count clock (b) tmm0 compare register 0 (tm0cmp0) if the tm0cmp0 register is set to d 0 , the interval is as follows. interval = (d 0 + 1) count clock cycle
chapter 9 16-bit interval timer m (tmm) user?s manual u16603ej5v1ud 452 (1) interval timer mode operation flow figure 9-5. software processing flow in interval timer mode <1> <2> tm0ce bit = 1 tm0ce bit = 0 register initial setting tm0ctl0 register (tm0cks0 to tm0cks2 bits) tm0cmp0 register initial setting of these registers is performed before the tm0ce bit is set to 1. the tm0cks0 to tm0cks2 bits cannot be set when counting starts (tm0ce bit = 1). the counter is initialized and counting is stopped by clearing the tm0ce bit to 0. start stop <1> count operation start flow <2> count operation stop flow d 0 d 0 d 0 d 0 ffffh 16-bit counter 0000h tm0ce bit tm0cmp0 register inttm0eq0 signal
chapter 9 16-bit interval timer m (tmm) user?s manual u16603ej5v1ud 453 (2) interval timer mode operation timing caution do not set the tm0cmp0 register to ffffh. (a) operation if tm0cmp0 register is set to 0000h if the tm0cmp0 register is set to 0000h, the inttm 0eq0 signal is generated at each count clock. the value of the 16-bit counter is always 0000h. count clock 16-bit counter tm0ce bit tm0cmp0 register inttm0eq0 signal 0000h ffffh 0000h 0000h 0000h 0000h interval time count clock cycle 2 interval time count clock cycle interval time count clock cycle (b) operation if tm0cmp0 register is set to n if the tm0cmp0 register is set to n, the 16-bit counter counts up to n. the counter is cleared to 0000h in synchronization with the next count-up timing and the inttm0eq0 signal is generated. ffffh 16-bit counter 0000h tm0ce bit tm0cmp0 register inttm0eq0 signal n interval time (n + 2) count clock cycle interval time (n + 1) count clock cycle interval time (n + 1) count clock cycle n remark 0000h < n < ffffh
chapter 9 16-bit interval timer m (tmm) user?s manual u16603ej5v1ud 454 9.4.2 cautions (1) it takes the 16-bit counter up to the following time to start counting after the tm0ctl0.tm0ce bit is set to 1, depending on the count clock selected. selected count clock maximum time before counting start f xx 2/f xx f xx /2 6/f xx f xx /4 24/f xx f xx /64 128/f xx f xx /512 1024/f xx intwt second rising edge of intwt signal f r /8 16/f r f xt 2/f xt (2) rewriting the tm0cmp0 and tm0ctl0 regist ers is prohibited while tmm0 is operating. if these registers are rewritten while the tm0ce bit is 1, the operation cannot be guaranteed. if they are rewritten by mistake, clear the tm0c tl0.tm0ce bit to 0, and re-set the registers. (3) do not set the tm0cmp0 register to ffffh.
user?s manual u16603ej5v1ud 455 chapter 10 watch timer functions 10.1 functions the watch timer has the following functions. ? watch timer: an interrupt request signal (intwt) is gene rated at intervals of 0.5 or 0.25 seconds by using the main clock or subclock. ? interval timer: an interrupt request sig nal (intwti) is generated at set intervals. the watch timer and interval timer functions can be used at the same time.
chapter 10 watch timer functions user?s manual u16603ej5v1ud 456 10.2 configuration the block diagram of the watch timer is shown below. figure 10-1. block diagram of watch timer internal bus watch timer operation mode register (wtm) f brg f w /2 4 f w /2 5 f w /2 6 f w /2 7 f w /2 8 f w /2 10 f w /2 11 f w /2 9 f xt 11-bit prescaler clear clear intwt intwti wtm0 wtm1 wtm2 wtm3 wtm4 wtm5 wtm6 wtm7 5-bit counter f w 3 f x f x /8 f x /4 f x /2 f x bgcs00 bgcs01 bgce0 3-bit prescaler 8-bit counter clear match f bgcs prsm0 register prscm0 register 2 internal bus clock control selector selector selector selector selector 1/2 remark f x : main clock oscillation frequency f bgcs : watch timer source clock frequency f brg : watch timer count clock frequency f xt : subclock frequency f w : watch timer clock frequency intwt: watch timer interrupt request signal intwti: interval timer interrupt request signal
chapter 10 watch timer functions user?s manual u16603ej5v1ud 457 (1) clock control this block controls supplying and stopping the operating clock (f x ) when the watch timer operates on the main clock. (2) 3-bit prescaler this prescaler divides f x to generate f x /2, f x /4, or f x /8. (3) 8-bit counter this 8-bit counter counts the source clock (f bgcs ). (4) 11-bit prescaler this prescaler divides f w to generate a clock of f w /2 4 to f w /2 11 . (5) 5-bit counter this counter counts f w or f w /2 9 , and generates a watch timer interrupt request signal at intervals of 2 4 /f w , 2 5 /f w , 2 13 /f w , or 2 14 /f w . (6) selector the watch timer has the following five selectors. ? selector that selects one of f x , f x /2, f x /4, or f x /8 as the source clock of the watch timer ? selector that selects the main clock (f x ) or subclock (f xt ) as the clock of the watch timer ? selector that selects f w or f w /2 9 as the count clock frequency of the 5-bit counter ? selector that selects 2 4 /f w , 2 13 /f w , 2 5 /f w , or 2 14 /f w as the intwt signal generation time interval ? selector that selects 2 4 /f w to 2 11 /f w as the interval timer interrupt re quest signal (intwti) generation time interval (7) prscm register this is an 8-bit compare register that sets the interval time. (8) prsm register this register controls clock supply to the watch timer. (9) wtm register this is an 8-bit register that contro ls the operation of the watch timer/in terval timer, and sets the interrupt request signal generation interval.
chapter 10 watch timer functions user?s manual u16603ej5v1ud 458 10.3 control registers the following registers are provided for the watch timer. ? prescaler mode register 0 (prsm0) ? prescaler compare register 0 (prscm0) ? watch timer operation mode register (wtm) (1) prescaler mode register 0 (prsm0) the prsm0 register controls the generat ion of the watch timer count clock. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 prsm0 0 0 bgce0 0 0 bgcs01 bgcs00 disabled enabled bgce0 0 1 main clock operation enable f x f x /2 f x /4 f x /8 5 mhz 200 ns 400 ns 800 ns 1.6 s 4 mhz 250 ns 500 ns 1 s 2 s bgcs01 0 0 1 1 bgcs00 0 1 0 1 selection of watch timer source clock (f bgcs ) after reset: 00h r/w address: fffff8b0h < > cautions 1. do not change the values of the bgcs00 and bgcs01 bits during watch timer operation. 2. set the prsm0 register befo re setting the bgce0 bit to 1. 3. set the prsm0 and prscm0 registers acco rding to the main clo ck frequency that is used so as to obtain an f brg frequency of 32.768 khz.
chapter 10 watch timer functions user?s manual u16603ej5v1ud 459 (2) prescaler compare register 0 (prscm0) the prscm0 register is an 8-bit compare register. this register can be read or written in 8-bit units. reset sets this register to 00h. prscm07 prscm0 prscm06 prscm05 prscm04 prscm03 prscm02 prscm01 prscm00 after reset: 00h r/w address: fffff8b1h cautions 1. do not rewrite the prscm0 register during watc h timer operation. 2. set the prscm0 register before setting the prsm0.bgce0 bit to 1. 3. set the prsm0 and prscm0 registers acco rding to the main clo ck frequency that is used so as to obtain an f brg frequency of 32.768 khz. the calculation for f brg is shown below. f brg = f bgcs /(2 n) remark f bgcs : watch timer source clock set by the prsm0 register n: set value of the prscm0 register = 1 to 256 however, n = 256 when the prscm0 register is set to 00h.
chapter 10 watch timer functions user?s manual u16603ej5v1ud 460 (3) watch timer operation mode register (wtm) the wtm register enables or di sables the count clock and operation of t he watch timer, sets the interval time of the prescaler, controls the operat ion of the 5-bit counter, and sets the set time of the watch flag. set the prsm0 register before setting the wtm register. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. (1/2) wtm7 2 4 /f w (488 s: f w = f xt ) 2 5 /f w (977 s: f w = f xt ) 2 6 /f w (1.95 ms: f w = f xt ) 2 7 /f w (3.91 ms: f w = f xt ) 2 8 /f w (7.81 ms: f w = f xt ) 2 9 /f w (15.6 ms: f w = f xt ) 2 10 /f w (31.3 ms: f w = f xt ) 2 11 /f w (62.5 ms: f w = f xt ) 2 4 /f w (488 s: f w = f brg ) 2 5 /f w (977 s: f w = f brg ) 2 6 /f w (1.95 ms: f w = f brg ) 2 7 /f w (3.91 ms: f w = f brg ) 2 8 /f w (7.81 ms: f w = f brg ) 2 9 /f w (15.6 ms: f w = f brg ) 2 10 /f w (31.3 ms: f w = f brg ) 2 11 /f w (62.5 ms: f w = f brg ) wtm7 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 wtm6 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 selection of interval time of prescaler wtm wtm6 wtm5 wtm4 wtm3 wtm2 wtm1 wtm0 wtm5 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 wtm4 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 after reset: 00h r/w address: fffff680h < > < >
chapter 10 watch timer functions user?s manual u16603ej5v1ud 461 (2/2) 2 14 /f w (0.5 s: f w = f xt ) 2 13 /f w (0.25 s: f w = f xt ) 2 5 /f w (977 s: f w = f xt ) 2 4 /f w (488 s: f w = f xt ) 2 14 /f w (0.5 s: f w = f brg ) 2 13 /f w (0.25 s: f w = f brg ) 2 5 /f w (977 s: f w = f brg ) 2 4 /f w (488 s: f w = f brg ) wtm7 0 0 0 0 1 1 1 1 selection of set time of watch flag clears after operation stops starts wtm1 0 1 control of 5-bit counter operation wtm3 0 0 1 1 0 0 1 1 wtm2 0 1 0 1 0 1 0 1 stops operation (clears both prescaler and 5-bit counter) enables operation wtm0 0 1 watch timer operation enable caution rewrite the wtm2 to wtm7 bits wh ile both the wtm0 and wtm1 bits are 0. remarks 1. f w : watch timer clock frequency 2. values in parentheses apply to operation with f w = 32.768 khz
chapter 10 watch timer functions user?s manual u16603ej5v1ud 462 10.4 operation 10.4.1 operation as watch timer the watch timer generates an interrupt request signal (int wt) at fixed time intervals. the watch timer operates using time intervals of 0.25 or 0.5 seconds wi th the subclock (32.768 khz) or main clock. the count operation starts when the wtm.wtm1 and wtm.wtm0 bits are set to 11. when the wtm0 bit is cleared to 0, the 11-bit prescaler and 5-bit co unter are cleared and the count operation stops. the time of the watch timer can be adjusted by clearin g the wtm1 bit to 0 and then the 5-bit counter when operating at the same time as the interval timer. at this time, an error of up to 15.6 ms may occur for the watch timer, but the interval timer is not affected. if the main clock is used as the count clock of the watc h timer, set the count clock using the prsm0.bgcs01 and prsm0.bgcs00 bits, the 8-bit comparison value using th e prscm0 register, and the count clock frequency (f brg ) of the watch timer to 32.768 khz. when the prsm0.bgce0 bit is set (1), f brg is supplied to the watch timer. f brg can be calculated by the following expression. f brg = f x /(2 m+1 n) to set f brg to 32.768 khz, perform the following calculat ion and set the bgcs01 and bgcs00 bits and the prscm0 register. <1> set n = f x /65,536. set m = 0. <2> when the value resulting from rounding up the first dec imal place of n is even, set n before the roundup as n/2 and m as m + 1. <3> repeat <2> until n is odd or m = 3. <4> set the value resulting from rounding up the first dec imal place of n to the prscm0 register and m to the bgcs01 and bgcs00 bits. example: when f x = 4.00 mhz <1> n = 4,000,000/65,536 = 61.03?, m = 0 <2>, <3> because n (round up the first decimal place) is odd, n = 61, m = 0. <4> set value of prscm0 register: 3dh (61), set value of bgcs01 and bgcs00 bits: 00 at this time, the actual f brg frequency is as follows. f brg = f x /(2 m+1 n) = 4,000,000/(2 61) = 32.787 khz remark m: division value (set value of bgcs01 and bgcs00 bits) = 0 to 3 n: set value of prscm0 register = 1 to 256 however, n = 256 when prscm0 register is set to 00h. f x : main clock oscillation frequency
chapter 10 watch timer functions user?s manual u16603ej5v1ud 463 10.4.2 operation as in terval timer the watch timer can also be used as an interval time r that repeatedly generates an interrupt request signal (intwti) at intervals specifie d by a preset count value. the interval time can be selected by the wtm.wtm4 to wtm.wtm7 bits. table 10-1. interval time of interval timer wtm7 wtm6 wtm5 wtm4 interval time 0 0 0 0 2 4 1/fw 488 s (operating at f w = f xt = 32.768 khz) 0 0 0 1 2 5 1/fw 977 s (operating at f w = f xt = 32.768 khz) 0 0 1 0 2 6 1/fw 1.95 ms (operating at f w = f xt = 32.768 khz) 0 0 1 1 2 7 1/fw 3.91 ms (operating at f w = f xt = 32.768 khz) 0 1 0 0 2 8 1/fw 7.81 ms (operating at f w = f xt = 32.768 khz) 0 1 0 1 2 9 1/fw 15.6 ms (operating at f w = f xt = 32.768 khz) 0 1 1 0 2 10 1/fw 31.3 ms (operating at f w = f xt = 32.768 khz) 0 1 1 1 2 11 1/fw 62.5 ms (operating at f w = f xt = 32.768 khz) 1 0 0 0 2 4 1/fw 488 s (operating at f w = f brg = 32.768 khz) 1 0 0 1 2 5 1/fw 977 s (operating at f w = f brg = 32.768 khz) 1 0 1 0 2 6 1/fw 1.95 ms (operating at f w = f brg = 32.768 khz) 1 0 1 1 2 7 1/fw 3.91 ms (operating at f w = f brg = 32.768 khz) 1 1 0 0 2 8 1/fw 7.81 ms (operating at f w = f brg = 32.768 khz) 1 1 0 1 2 9 1/fw 15.6 ms (operating at f w = f brg = 32.768 khz) 1 1 1 0 2 10 1/fw 31.3 ms (operating at f w = f brg = 32.768 khz) 1 1 1 1 2 11 1/fw 62.5 ms (operating at f w = f brg = 32.768 khz) remark f w : watch timer clock frequency
chapter 10 watch timer functions user?s manual u16603ej5v1ud 464 figure 10-2. operation timing of watch timer/interval timer start overflow overflow 0h interrupt time of watch timer (0.5 s) interrupt time of watch timer (0.5 s) interval time (t) interval time (t) nt nt 5-bit counter count clock f w or f w /2 9 watch timer interrupt intwt interval timer interrupt intwti remarks 1. when 0.5 seconds of the watch timer interrupt time is set. 2. f w : watch timer clock frequency values in parentheses apply to operation with f w = 32.768 khz. n: number of interval timer operations 10.4.3 cautions some time is required before the first watch timer interr upt request signal (intwt) is generated after operation is enabled (wtm.wtm1 and wtm.wtm0 bits = 1). figure 10-3. example of generation of watc h timer interrupt request signal (intwt) (when interrupt cycle = 0.5 s) it takes 0.515625 seconds (max.) for the first intwt signal to be generated (2 9 1/32768 = 0.015625 seconds longer (max.)). the intwt signal is then generated every 0.5 seconds. 0.5 s 0.5 s 0.515625 s wtm0, wtm1 intwt
user?s manual u16603ej5v1ud 465 chapter 11 functions of watchdog timer 2 11.1 functions watchdog timer 2 has the following functions. ? default-start watchdog timer note 1 reset mode: reset operation upon overflow of wa tchdog timer 2 (generation of wdt2res signal) non-maskable interrupt request mode: nmi operation upon overflow of watchdog timer 2 (generation of intwdt2 signal) note 2 ? input selectable from main clock, internal os cillation clock, and subclock as the source clock notes 1. watchdog timer 2 automatically starts in the reset mode following reset release. when watchdog timer 2 is not used, either stop its operation before reset is executed via this function, or clear watchdog timer 2 once and stop it within the next interval time. also, write to the wdtm2 register for verifi cation purposes only once, even if the default settings (reset mode, interval time: f r /2 19 ) do not need to be changed. 2. for the non-maskable interrupt servicing due to a non-maskable interrupt request signal (intwdt2), see 22.2.2 (2) intwdt2 signal .
chapter 11 functions of watchdog timer 2 user?s manual u16603ej5v1ud 466 11.2 configuration the following shows the block diagram of watchdog timer 2. figure 11-1. block diag ram of watchdog timer 2 f xx /2 9 clock input controller output controller wdt2res (internal reset signal) wdcs22 internal bus intwdt2 wdcs21 wdcs20 f xt wdcs23 wdcs24 0 wdm21 wdm20 selector 16-bit counter f xx /2 18 to f xx /2 25 , f xt /2 9 to f xt /2 16 , f r /2 12 to f r /2 19 watchdog timer enable register (wdte) watchdog timer mode register 2 (wdtm2) 3 3 2 clear f r /2 3 remark f xx : main clock frequency f xt : subclock frequency f r : internal oscillation clock frequency intwdt2: non-maskable interrupt request signal from watchdog timer 2 wdtres2: watchdog timer 2 reset signal watchdog timer 2 consists of the following hardware. table 11-1. configuration of watchdog timer 2 item configuration control registers watchdog timer mode register 2 (wdtm2) watchdog timer enable register (wdte)
chapter 11 functions of watchdog timer 2 user?s manual u16603ej5v1ud 467 11.3 registers (1) watchdog timer mode register 2 (wdtm2) the wdtm2 register sets the overflow time and operation clock of watchdog timer 2. this register can be read or written in 8-bit units. this register can be read any number of times, but it can be written only once following reset release. reset sets this register to 67h. caution accessing the wdtm2 register is prohibited in the following statuses. for details, see 3.4.9 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock a nd the main clock oscillation is stopped ? when the cpu operates with th e internal oscillation clock 0 wdtm2 wdm21 wdm20 wdcs24 wdcs23 wdcs22 wdcs21 wdcs20 after reset: 67h r/w address: fffff6d0h stops operation non-maskable interrupt request mode (generation of intwdt2 signal) reset mode (generation of wdt2res signal) wdm21 0 0 1 wdm20 0 1 ? selection of operation mode of watchdog timer 2 cautions 1. for details of the wdcs20 to w dcs24 bits, see table 11-2 watchdog timer 2 clock selection. 2. although watchdog timer 2 can be stopped just by stopping operation of the internal oscillator, clear the wdtm2 re gister to 00h to securely st op the timer (to avoid selection of the main clock or subclock due to an erroneous write operation). 3. if the wdtm2 register is rewritten twice after reset, an overflow signal is forcibly generated and the counter is reset. 4. to intentionally generate an overflow signa l, write data to the wdtm2 register only twice, or write a value other than ?ach? to the wdte register only once. however, when watchdog timer 2 is set to stop operation, an overflow signal is not generated even if data is written to the wdtm2 register only twice, or a value other than ?ach? is written to the wdte register only once. 5. to stop the operation of watchdog timer 2, set the rcm.rstop bit to 1 (to stop the internal oscillator) and write 00h in the wdtm 2 register. if the rcm.rstop bit cannot be set to 1, set the wdcs23 bit to 1 (2 n /f xx is selected and the clock can be stopped in the idle1, idle2, sub-idle, a nd subclock operation modes).
chapter 11 functions of watchdog timer 2 user?s manual u16603ej5v1ud 468 table 11-2. watchdog timer 2 clock selection wdcs24 wdcs23 wdcs22 wdcs21 wdcs20 selected clock 100 khz (min.) 200 khz (typ.) 400 khz (max.) 0 0 0 0 0 2 12 /f r 41.0 ms 20.5 ms 10.2 ms 0 0 0 0 1 2 13 /f r 81.9 ms 41.0 ms 20.5 ms 0 0 0 1 0 2 14 /f r 163.8 ms 81.9 ms 41.0 ms 0 0 0 1 1 2 15 /f r 327.7 ms 163.8 ms 81.9 ms 0 0 1 0 0 2 16 /f r 655.4 ms 327.7 ms 163.8 ms 0 0 1 0 1 2 17 /f r 1310.7 ms 655.4 ms 327.7 ms 0 0 1 1 0 2 18 /f r 2621.4 ms 1310.7 ms 655.4 ms 0 0 1 1 1 2 19 /f r 5242.9 ms 2621.47 ms 1310.7 ms f xx = 32 mhz note f xx = 20 mhz f xx = 16 mhz f xx = 10 mhz 0 1 0 0 0 2 18 /f xx 8.2 ms 13.1 ms 16.4 ms 26.2 ms 0 1 0 0 1 2 19 /f xx 16.4 ms 26.2 ms 32.8 ms 52.4 ms 0 1 0 1 0 2 20 /f xx 32.8 ms 52.4 ms 65.5 ms 104.9 ms 0 1 0 1 1 2 21 /f xx 65.5 ms 104.9 ms 131.1 ms 209.7 ms 0 1 1 0 0 2 22 /f xx 131.1 ms 209.7 ms 262.1 ms 419.4 ms 0 1 1 0 1 2 23 /f xx 262.1 ms 419.4 ms 524.3 ms 838.9 ms 0 1 1 1 0 2 24 /f xx 524.3 ms 838.9 ms 1048.6 ms 1677.7 ms 0 1 1 1 1 2 25 /f xx 1048.6 ms 1677.7 ms 2097.2 ms 3355.4 ms f xt = 32.768 khz 1 0 0 0 2 9 /f xt 15.625 ms 1 0 0 1 2 10 /f xt 31.25 ms 1 0 1 0 2 11 /f xt 62.5 ms 1 0 1 1 2 12 /f xt 125 ms 1 1 0 0 2 13 /f xt 250 ms 1 1 0 1 2 14 /f xt 500 ms 1 1 1 0 2 15 /f xt 1000 ms 1 1 1 1 2 16 /f xt 2000 ms note v850es/sj2-h only
chapter 11 functions of watchdog timer 2 user?s manual u16603ej5v1ud 469 (2) watchdog timer enable register (wdte) the counter of watchdog timer 2 is cleared and counting restarted by wr iting ?ach? to the wdte register. the wdte register can be read or written in 8-bit units. reset sets this register to 9ah. wdte after reset: 9ah r/w address: fffff6d1h cautions 1. when a value other than ?ach? is writ ten to the wdte register , an overflow signal is forcibly output. 2. when a 1-bit memory mani pulation instruction is execute d for the wdte register, an overflow signal is forcibly output. 3. to intentionally generate an overflow si gnal, write to the wdtm2 register only twice or write a value other than ?ach? to the wdte register once. however, when the watchdog timer 2 is set to stop operation, an overflow signal is not generated even if data is wri tten to the wdtm2 register only twice, or a value other than ?ach? is written to the wdte register only once. 4. the read value of the wdte register is ?9ah? (which differs from written value ?ach?). 11.4 operation watchdog timer 2 automatically starts in t he reset mode following reset release. the wdtm2 register can be written to only once following re set using byte access. to use watchdog timer 2, write the operation mode and the interval time to the wdtm2 register using an 8-bit me mory manipulation instruction. after this, the operation of watchdog timer 2 cannot be stopped. the wdtm2.wdcs24 to wdtm2.wdcs20 bits are used to select the watchdog timer 2 loop detection time interval. writing ach to the wdte register cl ears the counter of watchdog timer 2 an d starts the count operation again. after the count operation has start ed, write ach to wdte within the loop detection time interval. if the time interval expires without ach being written to the wdte register, a reset signal (wdt2res) or a non- maskable interrupt request signal (intwdt2) is gener ated, depending on the set values of the wdm21 and wdtm2.wdm20 bits. when the wdtm2.wdm21 bit is set to 1 (reset mode), if a wdt overflow occurs during oscillation stabilization after a reset or standby is released, no internal reset will oc cur and the cpu clock will switch to the internal oscillation clock. to not use watchdog timer 2, write 00h to the wdtm2 register. for the non-maskable interrupt servicing while t he non-maskable interrupt request mode is set, see 22.2.2 (2) intwdt2 signal .
user?s manual u16603ej5v1ud 470 chapter 12 real-time output function (rto) 12.1 function the real-time output function transfers preset data to the rtbln and rtbh n registers, and then transfers this data by hardware to an external device via the output latches, upon occurrence of a timer interrupt. the pins through which the data is output to an external device constitute a port called the real-tim e output function (rto). because rto can output signals without jitter, it is suitable for controlling a stepper motor. in the v850es/sj2 and v850es/sj2-h, two 6-bit real-time output port c hannels are provided. the real-time output port can be se t to the port mode or real-time output port mode in 1-bit units. remark n = 0, 1
chapter 12 real-time output function (rto) user?s manual u16603ej5v1ud 471 12.2 configuration the block diagram of rto is shown below. figure 12-1. block diagram of rto real-time output buffer register nh (rtbhn) real-time output latch nh selector inttp0cc0, inttp6cc0 note 1 inttp5cc0, inttp8cc0 note 2 inttp4cc0, inttp7cc0 note 3 real-time output latch nl rtpoen rtpegn byten extrn real-time output port control register n (rtpcn) transfer trigger (h) transfer trigger (l) rtpmn5 rtpmn4 rtpmn3 rtpmn2 rtpmn1 rtpmn0 real-time output port mode register n (rtpmn) 4 2 2 4 internal bus real-time output buffer register nl (rtbln) rtpn4, rtpn5 rtpn0 to rtpn3 notes 1. inttp0cc0 when n = 0, inttp6cc0 when n = 1 2. inttp5cc0 when n = 0, inttp8cc0 when n = 1 3. inttp4cc0 when n = 0, inttp7cc0 when n = 1 remark n = 0, 1 rto consists of the following hardware. table 12-1. configuration of rto item configuration registers real-time output buffer r egisters nl, nh (rtbln, rtbhn) control registers real-time output port mode register n (rtpmn) real-time output port control register n (rtpcn)
chapter 12 real-time output function (rto) user?s manual u16603ej5v1ud 472 (1) real-time output buffer registers nl, nh (rtbln, rtbhn) the rtbln and rtbhn registers are 4-bit registers that hold preset output data. these registers are mapped to independent addresses in the peripheral i/o register area. these registers can be read or wr itten in 8-bit or 1-bit units. reset input clears these registers to 00h. if an operation mode of 4 bits 1 channel or 2 bits 1 channel is specified (rtpcn.byten bit = 0), data can be individually set to the rtbln and rtbhn registers. the data of both these r egisters can be read at once by specifying the address of either of these registers. if an operation mode of 6 bits 1 channel is specified (byten bit = 1), 8-bit data can be set to both the rtbln and rtbhn registers by writing the da ta to either of these registers. moreover, the data of both these registers can be read at once by specifying the address of either of these registers. table 12-2 shows the operation when the rt bln and rtbhn register s are manipulated. 0 rtbln rtbhn 0 rtbhn5 rtbhn4 rtbln3 rtbln2 rtbln1 rtbln0 after reset: 00h r/w address: rtbl0 fffff6e0h, rtbh0 fffff6e2h, rtbl1 fffff6f0h, rtbh1 fffff6f2h cautions 1. when writing to bits 6 and 7 of the rtbhn register, always write 0. 2. accessing the rtbln and rtbhn registers is prohibited in the following statuses. for details, see 3.4.9 (2) accessing specifi c on-chip peripheral i/o registers. ? when the cpu operates with the subclock a nd the main clock oscillation is stopped ? when the cpu operates with th e internal oscillation clock remark n = 0, 1 table 12-2. operation during manipulation of rtbln and rtbhn registers read write note operation mode register to be manipulated higher 4 bits lower 4 bits higher 4 bits lower 4 bits rtbln rtbhn rtbln invalid rtbln 4 bits 1 channel, 2 bits 1 channel rtbhn rtbhn rtbln rtbhn invalid rtbln rtbhn rtbln rtbhn rtbln 6 bits 1 channel rtbhn rtbhn rtbln rtbhn rtbln note after setting the real-time output port, set output dat a to the rtbln and rtbhn registers by the time a real-time output trigger is generated.
chapter 12 real-time output function (rto) user?s manual u16603ej5v1ud 473 12.3 registers rto is controlled using the following two registers. ? real-time output port mode register n (rtpmn) ? real-time output port control register n (rtpcn) (1) real-time output port mode register n (rtpmn) the rtpmn register selects t he real-time output port mode or port mode in 1-bit units. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 rtpmnm 0 1 real-time output disabled real-time output enabled control of real-time output port (m = 0 to 5) rtpmn (n = 0, 1) 0 rtpmn5 rtpmn4 rtpmn3 rtpmn2 rtpmn1 rtpmn0 after reset: 00h r/w address: rtpm0 fffff6e4h, rtpm1 fffff6f4h cautions 1. by enabling the real-time output opera tion (rtpcn.rtpoen bit = 1), the bits enabled to real-time output among the rtpn0 to rtpn 5 signals perform real-time output, and the bits set to port mode output 0. 2. if real-time output is disabled (rtpoen bi t = 0), the real-time output pins (rtpn0 to rtpn5) all output 0, regardless of the rtpmn register setting. 3. in order to use this register as the real -time output pins (rtpn0 to rtpn5), set these pins as real-time output port pins using the pmc and pfc registers.
chapter 12 real-time output function (rto) user?s manual u16603ej5v1ud 474 (2) real-time output port control register 0 (rtpc0) the rtpc0 register is a register that sets the operat ion mode and output trigger of the real-time output port. the relationship between the operation mo de and output trigger of the real -time output port is as shown in tables 12-3 and 12-4. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. rtpoen disables operation note 1 enables operation rtpoen 0 1 control of real-time output operation rtpcn (n = 0, 1) rtpegn byten extrn 0 0 0 0 falling edge note 2 rising edge rtpegn 0 1 valid edge of inttpacc0 (n = 0, a = 0, 4, 5) and inttpbcc0 (n = 1, b = 6 to 8) signals 4 bits 2 channels, 2 bits 2 channels 6 bits 2 channels byten 0 1 specification of channel configuration for real-time output after reset: 00h r/w address: rtpc0 fffff6e5h, rtpc1 fffff6f5h < > notes 1. when the real-time output operation is disabled (rtpoen bit = 0), all the bits of the real-time output signals (rtpn0 to rtpn5) output ?0?. 2. the inttp0cc0 and inttp6cc0 signals are output for 1 clock of the count clock selected by tmp0 and tmp6. caution set the rtpegn, byten, and ext rn bits only when rtpoen bit = 0. table 12-3. operation modes and output trig gers of real-time output port (n = 0) byte0 extr0 operation mode rtbh0 (rtp 04, rtp05) rtbl0 (rtp00 to rtp03) 0 inttp5cc0 inttp4cc0 0 1 4 bits 1 channel, 2 bits 1 channel inttp4cc0 inttp0cc0 0 inttp4cc0 1 1 6 bits 1 channel inttp0cc0 table 12-4. operation modes and output trig gers of real-time output port (n = 1) byte1 extr1 operation mode rtbh1 (rtp 14, rtp15) rtbl1 (rtp10 to rtp13) 0 inttp8cc0 inttp7cc0 0 1 4 bits 1 channel, 2 bits 1 channel inttp7cc0 inttp6cc0 0 inttp7cc0 1 1 6 bits 1 channel inttp6cc0
chapter 12 real-time output function (rto) user?s manual u16603ej5v1ud 475 12.4 operation if the real-time output operation is enabled by setting the rtpcn.rtpoen bi t to 1, the data of the rtbhn and rtbln registers is transferred to the real-time output latch in synchronizati on with the generation of the selected transfer trigger (set by the rtpcn.extrn and rtpcn.byten bits). of the trans ferred data, only the data of the bits for which real-time output is enabled by the rtpmn register is output from t he rtpn0 to rtpn5 bits. the bits for which real-time output is disabled by the rtpmn register output 0. if the real-time output operatio n is disabled by clearing the rtpoen bit to 0, the rtpn0 to rtpn5 signals output 0 regardless of the setting of the rtpmn register. figure 12-2. example of operation timing of rto0 (when extr0 bit = 0, byte0 bit = 0) abababab d01 d02 d03 d04 d11 d12 d13 d14 d11 d12 d13 d14 d01 d02 d03 d04 inttp5cc0 (internal) inttp4cc0 (internal) cpu operation rtbh0 rtbl0 rt output latch 0 (h) rt output latch 0 (l) a: software processing by inttp5cc0 interrupt request (rtbh0 write) b: software processing by inttp4cc0 interrupt request (rtbl0 write) remark for the operation during standby, see chapter 24 standby function .
chapter 12 real-time output function (rto) user?s manual u16603ej5v1ud 476 12.5 usage (1) disable real-time output. clear the rtpcn.rtpoen bit to 0. (2) perform initialization as follows. ? set the alternate-function pins of port 5 set the pfc5.pfc5m bit and pfce5.pfce5m bit to 1, and then set the pmc5.pmc5m bit to 1 (m = 0 to 5). ? specify the real-time output port mode or port mode in 1-bit units. set the rtpmn register. ? channel configuration: select the trigger and valid edge. set the rtpcn.extrn, rtpcn. byten, and rtpcn.rtpegn bits. ? set the initial values to the rtbhn and rtbln registers note 1 . (3) enable real-time output. set the rtpoen bit = 1. (4) set the next output value to the rtbhn and rtbln registers by the time the selected transfer trigger is generated note 2 . (5) set the next real-time output value to the rtbhn and rt bln registers via interrupt servicing corresponding to the selected trigger. notes 1. if the rtbhn and rtbln registers are written when the rtpoen bit = 0, that value is transferred to real-time output latches nh and nl, respectively. 2. even if the rtbhn and rtbln r egisters are written when the rt poen bit = 1, data is not transferred to real-time output latches nh and nl. 12.6 cautions (1) prevent the following conflicts by software. ? conflict between real-time output disable/enable switching (rtpoen bi t) and selected real-time output trigger. ? conflict between writing to the rtbhn and rtbln regist ers in the real-time output enabled status and the selected real-time output trigger. (2) before performing initialization, disable real-time output (rtpoen bit = 0). (3) once real-time output has been disabled (rtpoen bit = 0), be sure to initialize the rtbhn and rtbln registers before enabling real-time output again (rtpoen bit = 0 1).
user?s manual u16603ej5v1ud 477 chapter 13 a/d converter 13.1 overview the a/d converter converts analog input signals into digital values, has a resolution of 10 bits, and can handle 16 analog input signal channels (ani0 to ani15). the a/d converter has the following features. { 10-bit resolution { 16 channels { successive approximation method { operating voltage: av ref0 = 3.0 to 3.6 v { analog input voltage: 0 v to av ref0 { the following functions are provided as operation modes. ? continuous select mode ? continuous scan mode ? one-shot select mode ? one-shot scan mode { the following functions are provided as trigger modes. ? software trigger mode ? external trigger mode (external, 1) ? timer trigger mode { power-fail monitor function (conversion result compare function) 13.2 functions (1) 10-bit resolution a/d conversion an analog input channel is selected from ani0 to an i15, and an a/d conversion op eration is repeated at a resolution of 10 bits. each time a/d conversion has been completed, an interrupt request signal (intad) is generated. (2) power-fail detection function this function is used to detect a drop in the battery volt age. the result of a/d conversion (the value of the ada0crnh register) is compared with the value of t he ada0pft register, and the intad signal is generated only when a specified comparison condition is satisfied (n = 0 to 15).
chapter 13 a/d converter user?s manual u16603ej5v1ud 478 13.3 configuration the block diagram of the a/d converter is shown below. figure 13-1. block diagram of a/d converter ani0 : : ani1 ani2 ani13 ani14 ani15 ada0m2 ada0m1 ada0m0 ada0s ada0pft controller voltage comparator ada0pfm voltage comparator ada0cr0 ada0cr1 : : ada0cr2 ada0cr14 ada0cr15 internal bus av ref0 ada0ce bit av ss intad edge detection adtrg controller sample & hold circuit tap selector ada0ets0 bit inttp2cc0 inttp2cc1 ada0ets1 bit ada0ce bit ada0tmd1 bit ada0tmd0 bit selector selector ada0pfe bit ada0pfc bit sar series resistor string the a/d converter includes the following hardware. table 13-1. configuration of a/d converter item configuration analog inputs 16 channels (ani0 to ani15 pins) registers successive approximation register (sar) a/d conversion result registers 0 to 15 (ada0cr0 to ada0cr15) a/d conversion result registers 0h to 15h (adcr0h to adcr15h): only higher 8 bits can be read control registers a/d converter mode registers 0 to 2 (ada0m0 to ada0m2) a/d converter channel specification register 0 (ada0s) power fail compare mode register (ada0pfm) power fail compare threshold value register (ada0pft)
chapter 13 a/d converter user?s manual u16603ej5v1ud 479 (1) successive approximation register (sar) the sar register compares the volta ge value of the analog input signal with the voltage tap (compare voltage) value from the series resistor string, and holds the co mparison result starting from the most significant bit (msb). when the comparison result has been held down to the le ast significant bit (lsb) (i.e., when a/d conversion is complete), the contents of the sar register are transferred to the ada0crn register. remark n = 0 to 15 (2) a/d conversion result register n (ada0crn), a/d conversion result register nh (ada0crnh) the ada0crn register is a 16-bit regi ster that stores the a/d conversi on result. ada0arn consist of 16 registers and the a/d conversion result is stored in the 10 higher bits of the ad0crn register corresponding to analog input. (the lower 6 bits are fixed to 0.) (3) a/d converter mode register 0 (ada0m0) this register specifies the operation mode and cont rols the conversion operation by the a/d converter. (4) a/d converter mode register 1 (ada0m1) this register sets the conversion time of the analog input signal to be converted. (5) a/d converter mode register 2 (ada0m2) this register sets the hardware trigger mode. (6) a/d converter channel specification register (ada0s) this register sets the input port that inputs the analog voltage to be converted. (7) power-fail compare m ode register (ada0pfm) this register sets the power-fail monitor mode. (8) power-fail compare threshol d value register (ada0pft) the ada0pft register sets a threshold value that is compared with the value of a/d conversion result register nh (ada0crnh). the 8-bit data set to the ada0pft register is compared with the higher 8 bits of the a/d conversion result register (ada0crnh). (9) controller the controller compares the result of the a/d conversion (the value of the ada0crnh register) with the value of the ada0pft register when a/d co nversion is completed or when the power-fail detection function is used, and generates the intad signal only when a spec ified comparison condition is satisfied. (10) sample & hold circuit the sample & hold circuit samples each of the analog input signals selected by the input circuit and sends the sampled data to the voltage comparator. this circuit also holds the sampled analog input signal voltage during a/d conversion.
chapter 13 a/d converter user?s manual u16603ej5v1ud 480 (11) voltage comparator the voltage comparator compares a voltage value that has been sample d and held with the voltage value of the series resistor string. (12) series resistor string this series resistor string is connected between av ref0 and av ss and generates a voltage for comparison with the analog input signal. (13) ani0 to ani15 pins these are analog input pins for the 16 a/d converter channels and are used to input analog signals to be converted into digital signals. pins other than the one selected as the analog input by the ada0s register can be used as input port pins. caution make sure that the voltag es input to the ani0 to ani15 pins do not exceed the rated values. in particular if a voltage of av ref0 or higher is input to a channel, the conversion value of that channel becomes undefined, and the conver sion values of the other channels may also be affected. (14) av ref0 pin this is the pin used to input the reference voltage of t he a/d converter. always make the potential at this pin the same as that at the v dd pin even when the a/d converter is not used. the signals input to the ani0 to ani15 pins are c onverted to digital signals based on the voltage applied between the av ref0 and av ss pins. (15) av ss pin this is the ground pin of t he a/d converter. always make the potential at this pin the same as that at the v ss pin even when the a/d converter is not used.
chapter 13 a/d converter user?s manual u16603ej5v1ud 481 13.4 registers the a/d converter is controlled by the following registers. ? a/d converter mode registers 0, 1, 2 (ada0m0, ada0m1, ada0m2) ? a/d converter channel specification register 0 (ada0s) ? power-fail compare mode register (ada0pfm) the following registers are also used. ? a/d conversion result register n (ada0crn) ? a/d conversion result register nh (ada0crnh) ? power-fail compare threshold value register (ada0pft) (1) a/d converter mode register 0 (ada0m0) the ada0m0 register is an 8-bit register that specif ies the operation mode and controls conversion operations. this register can be read or written in 8-bit or 1-bit units. however, ada0ef bit is read-only. reset sets this register to 00h. caution accessing the ada0m0 register is prohibited in th e following statuses. for details, see 3.4.9 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock a nd the main clock oscillation is stopped ? when the cpu operates with th e internal oscillation clock (1/2) ada0ce ada0ce 0 1 stops a/d conversion enables a/d conversion a/d conversion control ada0m0 0 ada0md1 ada0md0 ada0ets1 ada0ets0 ada0tmd ada0ef ada0md1 0 0 1 1 ada0md0 0 1 0 1 continuous select mode continuous scan mode one-shot select mode one-shot scan mode specification of a/d converter operation mode after reset: 00h r/w address: fffff200h < > < >
chapter 13 a/d converter user?s manual u16603ej5v1ud 482 (2/2) ada0tmd 0 1 software trigger mode external trigger mode/timer trigger mode trigger mode specification ada0ef 0 1 a/d conversion stopped a/d conversion in progress a/d converter status display ada0ets1 0 0 1 1 ada0ets0 0 1 0 1 no edge detection falling edge detection rising edge detection detection of both rising and falling edges specification of external trigger (adtrg pin) input valid edge cautions 1. if bit 0 is wr itten, this is ignored. 2. changing the ada0m1 register is prohib ited while a/d conversion is enabled (ada0ce bit = 1). 3. in the following modes, write data to the ada0m0, ada0m2, ada0s, ada0pfm, and ada0pft registers while a/d conversion is stopped (ada0ce bit = 0), and then enable the a/d conversion operation (ada0ce bit = 1). ? normal conversion mode ? one-shot select mode/one-shot scan mode of high-speed conversion mode if data is written to the ada0m0, ada0m2 , ada0s, ada0pfm, and ada0pft registers in any other modes during a/d conversion (ada0ef bit = 1), the operation is performed as follows, depending on the mode. ? in software trigger mode a/d conversion is stopped and started again from the beginning. ? in hardware trigger mode a/d conversion is stopped, and the trigger standby state is set. 4. to select the external trigger mode/timer trigger mode (ada0tmd bit = 1), set the high- speed conversion mode (ada0m1.ada0hs1 bi t = 1). do not input a trigger during stabilization time that is inserted once af ter the a/d conversion operation is enabled (ada0ce bit = 1). 5. when not using the a/d converter, stop the operation by setting the ada0ce bit to 0 to reduce the power consumption.
chapter 13 a/d converter user?s manual u16603ej5v1ud 483 (2) a/d converter mode register 1 (ada0m1) the ada0m1 register is an 8-bit regist er that specifies the conversion time. this register can be read or written in 8-bit or 1-bit units. reset sets this bit to 00h. ada0hs1 ada0m1 0 00 ada0fr3 note ada0fr2 ada0fr1 ada0fr0 after reset: 00h r/w address: fffff201h ada0hs1 0 1 normal conversion mode high-speed conversion mode specification of normal conversion mode/high-speed mode (a/d conversion time) note v850es/sj2-h only cautions 1. changing the ada0m1 register is prohibited while a/d conversion is enabled (ada0m0.ada0ce bit = 1). 2. to select the external trigger mode/timer trigger mode (ada0m0.ada0tmd bit = 1), set the high-speed conversion mode (ada0hs1 bit = 1). do not input a trigger during stabilization time that is inserted only on ce after the a/d conversion operation is enabled (ada0ce bit = 1). 3. in the v850es/sj2, be sure to set bits 6 to 3 to ?0?, and in the v850es/sj2-h, be sure to set bits 6 to 4 to ?0?. remark for a/d conversion time setting examples, see tables 13-2 and 13-3 .
chapter 13 a/d converter user?s manual u16603ej5v1ud 484 table 13-2. conversion time selection in normal conversion mode (ada0hs1 bit = 0) a/d conversion time ada0fr3 to ada0fr0 bits note 1 stabilization time + conversion time + wait time f xx = 32 mhz note 2 f xx = 20 mhz f xx = 16 mhz f xx = 4 mhz tr i g g e r response time 0000 66/f xx (13/f xx + 26/f xx + 27/f xx ) setting prohibited setting prohibited setting prohibited 16.50 s 3/f xx 0001 131/f xx (26/f xx + 52/f xx + 53/f xx ) setting prohibited 6.55 s 8.19 s setting prohibited 3/f xx 0010 196/f xx (39/f xx + 78/f xx + 79/f xx ) setting prohibited 9.80 s 12.25 s setting prohibited 3/f xx 0011 259/f xx (50/f xx + 104/f xx + 105/f xx ) 8.09 s 12.95 s 16.19 s setting prohibited 3/f xx 0100 311/f xx (50/f xx + 130/f xx + 131/f xx ) 9.72 s 15.55 s 19.44 s setting prohibited 3/f xx 0101 363/f xx (50/f xx + 156/f xx + 157/f xx ) 11.34 s 18.15 s 22.69 s setting prohibited 3/f xx 0110 415/f xx (50/f xx + 182/f xx + 183/f xx ) 12.97 s 20.75 s setting prohibited setting prohibited 3/f xx 0111 467/f xx (50/f xx + 208/f xx + 209/f xx ) 14.59 s 23.35 s setting prohibited setting prohibited 3/f xx 1000 519/f xx (50/f xx + 234/f xx + 235/f xx ) 16.22 s setting prohibited setting prohibited setting prohibited 3/f xx 1001 571/f xx (50/f xx + 260/f xx + 261/f xx ) 17.84 s setting prohibited setting prohibited setting prohibited 3/f xx 1010 623/f xx (50/f xx + 286/f xx + 287/f xx ) 19.47 s setting prohibited setting prohibited setting prohibited 3/f xx 1011 675/f xx (50/f xx + 312/f xx + 313/f xx ) 21.09 s setting prohibited setting prohibited setting prohibited 3/f xx other than above setting prohibited notes 1. v850es/sj2: ada0fr2 to ada0fr0 bits v850es/sj2-h: ada0fr3 to ada0fr0 bits 2. v850es/sj2-h only remark stabilization time: a/d converter setup time (1 s or longer) conversion time: actual a/d conversion time (2.6 to 10.4 s) wait time: wait time inserted before the next conversion trigger response time: if a software trigger, exter nal trigger, or timer trigger is generated after the stabilization time, it is inserted before the conversion time. in the normal conversion mode, the conversion is st arted after the stabilization time elapsed from the ada0m0.ada0ce bit is set to 1, and a/d conversion is performed only during the conversion time (2.6 to 10.4 s). operation is stopped after the conversion ends and the a/d conversion end interrupt request signal (intad) is generated after the wait time is elapsed. because the conversion operation is stopped during the wait time, operation current can be reduced. caution set as 2.6 s conversion time 10.4 s.
chapter 13 a/d converter user?s manual u16603ej5v1ud 485 table 13-3. conversion time selection in hi gh-speed conversion mode (ada0hs1 bit = 1) a/d conversion time ada0fr3 to ada0fr0 bits note 1 conversion time (+ stabilization time) f xx = 32 mhz note 2 f xx = 20 mhz f xx = 16 mhz f xx = 4 mhz trigger response time 0000 26/f xx (+ 13/f xx ) setting prohibited setting pr ohibited setting prohibited 6.5 s (+ 3.25 s) 3/f xx 0001 52/f xx (+ 26/f xx ) setting prohibited 2.6 s (+ 1.3 s) 3.25 s (+ 1.625 s) setting prohibited 3/f xx 0010 78/f xx (+ 39/f xx ) setting prohibited 3.9 s (+ 1.95 s) 4.875 s (+ 2.4375 s) setting prohibited 3/f xx 0011 104/f xx (+ 50/f xx ) 3.25 s (+ 1.5625 s) 5.2 s (+ 2.5 s) 6.5 s (+ 3.125 s) setting prohibited 3/f xx 0100 130/f xx (+ 50/f xx ) 4.0625 s (+ 1.5625 s) 6.5 s (+ 2.5 s) 8.125 s (+ 3.125 s) setting prohibited 3/f xx 0101 156/f xx (+ 50/f xx ) 4.875 s (+ 1.5625 s) 7.8 s (+ 2.5 s) 9.75 s (+ 3.125 s) setting prohibited 3/f xx 0110 182/f xx (+ 50/f xx ) 5.6875 s (+ 1.5625 s) 9.1 s (+ 2.5 s) setting prohibited setting prohibited 3/f xx 0111 208/f xx (+ 50/f xx ) 6.5 s (+ 1.5625 s) 10.4 s (+ 2.5 s) setting prohibited setting prohibited 3/f xx 1000 234/f xx (+ 50/f xx ) 7.3125 s (+ 1.5625 s) setting prohibited setting prohi bited setting prohibited 3/f xx 1001 260/f xx (+ 50/f xx ) 8.125 s (+ 1.5625 s) setting prohibited setting prohi bited setting prohibited 3/f xx 1010 286/f xx (+ 50/f xx ) 8.9375 s (+ 1.5625 s) setting prohibited setting prohi bited setting prohibited 3/f xx 1011 312/f xx (+ 50/f xx ) 9.75 s (+ 1.5625 s) setting prohibited setting prohi bited setting prohibited 3/f xx other than above setting prohibited notes 1. v850es/sj2: ada0fr2 to ada0fr0 bits v850es/sj2-h: ada0fr3 to ada0fr0 bits 2. v850es/sj2-h only remark conversion time: actual a/d co nversion time (2.6 to 10.4 s) stabilization time: a/d converter setup time (1 s or longer) trigger response time: if a software trigger, exter nal trigger, or timer trigger is generated after the stabilization time, it is inserted before the conversion time. in the high-speed conversion mode, the conversion is started after the stabilization time elapsed from the ada0m0.ada0ce bit is set to 1, and a/d conversion is performed only during the conversion time (2.6 to 10.4 s). the a/d conversion end interrupt request sig nal (intad) is generated immediately after the conversion ends. in continuous conversion mode, the stabilization time is inserted only before the first conversion, and not inserted after the second conversion (the a/d converter remains running). caution set as 2.6 s conversion time 10.4 s.
chapter 13 a/d converter user?s manual u16603ej5v1ud 486 (3) a/d converter mode register 2 (ada0m2) the ada0m2 register specifies the hardware trigger mode. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 ada0m2 0 0 0 00 ada0tmd1 ada0tmd0 ada0tmd1 0 0 1 1 ada0tmd0 0 1 0 1 specification of hardware trigger mode external trigger mode (when adtrg pin valid edge detected) timer trigger mode 0 (when inttp2cc0 interrupt request generated) timer trigger mode 1 (when inttp2cc1 interrupt request generated) setting prohibited after reset: 00h r/w address: fffff203h 6543210 7 cautions 1. in the following modes, write data to the ada0m2 register while a/d conversion is stopped (ada0m0.ada0ce bit = 0), and th en enable the a/d conversion operation (ada0ce bit = 1). ? normal conversion mode ? one-shot select mode/one-shot scan mo de of the high-speed conversion mode 2. be sure to clear bits 7 to 2 to ?0?.
chapter 13 a/d converter user?s manual u16603ej5v1ud 487 (4) analog input channel specification register (ada0s) the ada0s register specifies the pin that inputs the analog voltage to be converted into a digital signal. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 ada0s 0 0 0 ada0s3 ada0s2 ada0s1 ada0s0 after reset: 00h r/w address: fffff202h ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 ani8 ani9 ani10 ani11 ani12 ani13 ani14 ani15 ani0 ani0, ani1 ani0 to ani2 ani0 to ani3 ani0 to ani4 ani0 to ani5 ani0 to ani6 ani0 to ani7 ani0 to ani8 ani0 to ani9 ani0 to ani10 ani0 to ani11 ani0 to ani12 ani0 to ani13 ani0 to ani14 ani0 to ani15 ada0s3 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ada0s2 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 ada0s1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 ada0s0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 select mode scan mode cautions 1. in the following modes, write data to the ada0s register while a/d conversion is stopped (ada0m0.ada0ce bit = 0), and th en enable the a/d conversion operation (ada0ce bit = 1). ? normal conversion mode ? one-shot select mode/one-shot scan mo de of the high-speed conversion mode 2. be sure to clear bits 7 to 4 to ?0?.
chapter 13 a/d converter user?s manual u16603ej5v1ud 488 (5) a/d conversion result regist ers n, nh (ada0crn, ada0crnh) the ada0crn and ada0crnh registers st ore the a/d conversion results. these registers are read-only, in 16-bit or 8-bit units. however, specify the ada0crn register for 16-bit access and the ada0crnh register for 8-bit access. the 10 bits of the conversion result are read from the higher 10 bits of the ada0crn register, and 0 is read from the lower 6 bits. the higher 8 bits of the conversion result are read from the ada0crnh register. caution accessing the ada0crn and ada0crnh regist ers is prohibited in the following statuses. for details, see 3.4.9 (2) accessing speci fic on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock after reset: undefined r address: ada0cr0 fffff210h, ada0cr1 fffff212h, ada0cr2 fffff214h, ada0cr3 fffff216h, ada0cr4 fffff218h, ada0cr5 fffff21ah, ada0cr6 fffff21ch, ada0cr7 fffff21eh, ada0cr8 fffff220h, ada0cr9 fffff222h, ada0cr10 fffff224h, ada0cr11 fffff226h. ada0cr12 fffff228h, ada0cr13 fffff22ah, ada0cr14 fffff22ch, ada0cr15 fffff22eh ada0crn (n = 0 to 15) ad9 ad8 ad7 ad6 ad0000000 ad1 ad2 ad3 ad4 ad5 ad9 ada0crnh (n = 0 to 15) ad8 ad7 ad6 ad5 ad4 ad3 ad2 76 54 32 1 0 after reset: undefined r address: ada0cr0h fffff211h, ada0cr1h fffff213h, ada0cr2h fffff215h, ada0cr3h fffff217h, ada0cr4h fffff219h, ada0cr5h fffff21bh, ada0cr6h fffff21dh, ada0cr7h fffff21fh, ada0cr8h fffff221h, ada0cr9h fffff223h, ada0cr10h fffff225h, ada0cr11h fffff227h, ada0cr12h fffff229h, ada0cr13h fffff22bh, ada0cr14h fffff22dh, ada0cr15h fffff22fh caution a write operation to the ada0m0 and ada0s registers may cause the contents of the ada0crn register to become undefined. afte r the conversion, read the conversion result before writing to the ada0m0 and ada0s regi sters. correct conversion results may not be read if a sequence othe r than the above is used.
chapter 13 a/d converter user?s manual u16603ej5v1ud 489 the relationship between the analog volt age input to the analog input pins (a ni0 to ani15) and the a/d conversion result (ada0crn register) is as follows. v in ada0cr = int ( av ref0 1,024 + 0.5) ada0cr note = sar 64 or, av ref0 av ref0 (sar ? 0.5) 1,024 v in < (sar + 0.5) 1,024 int( ): function that returns the integer of the value in ( ) v in : analog input voltage av ref0 : av ref0 pin voltage ada0cr: value of ada0crn register note the lower 6 bits of the ada0crn register are fixed to 0. the following shows the relationship between the analo g input voltage and the a/d conversion results. figure 13-2. relationship between analog input voltage and a/d conversion results 1,023 1,022 1,021 3 2 1 0 input voltage/av ref0 1 2,048 1 1,024 3 2,048 2 1,024 5 2,048 3 1,024 2,043 2,048 1,022 1,024 2,045 2,048 1,023 1,024 2,047 2,048 1 a/d conversion results ada0crn sar ffc0h ff80h ff40h 00c0h 0080h 0040h 0000h
chapter 13 a/d converter user?s manual u16603ej5v1ud 490 (6) power-fail compare m ode register (ada0pfm) the ada0pfm register is an 8-bit register that sets the power-fail compare mode. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. ada0pfe power-fail compare disabled power-fail compare enabled ada0pfe 0 1 selection of power-fail compare enable/disable ada0pfm ada0pfc 00 00 0 0 generates an interrupt request signal (intad) when ada0crnh ada0pft generates an interrupt request signal (intad) when ada0crnh < ada0pft ada0pfc 0 1 selection of power-fail compare mode after reset: 00h r/w address: fffff204h <7>6543210 cautions 1. in the select mode, the 8-bit data set to the ada0pft regist er is compared with the value of the ada0crnh register specified by the ada0s register. if the result matches the condition specified by th e ada0pfc bit, the conversion result is stored in the ada0crn register and the intad signal is ge nerated. if it does not match, however, the interrupt signal is not generated. 2. in the scan mode, the 8-bit data set to the ada0pft register is compared with the contents of the ada0cr0h register. if th e result matches the c ondition specified by the ada0pfc bit, the conversion result is stored in the ada0cr0 register and the intad signal is generated. if it does not match, however, the intad signal is not generated. regardless of the comparison r esult, the scan operati on is continued and the conversion result is st ored in the ada0crn register until the scan operation is completed. however, the intad signal is not generated after th e scan operation has been completed. 3. in the following modes, write data to the ada0pfm register while a/d conversion is stopped (ada0m0.ada0ce bit = 0), and th en enable the a/d conversion operation (ada0ce bit = 1). ? normal conversion mode ? one-shot select mode/one-shot scan mo de of the high-speed conversion mode
chapter 13 a/d converter user?s manual u16603ej5v1ud 491 (7) power-fail compare thres hold value register (ada0pft) the ada0pft register sets the compare value in the power-fail compare mode. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. ada0pft after reset: 00h r/w address: fffff205h 76 54 321 0 caution in the following modes, write data to the ada0pft register while a/d conversion is stopped (ada0m0.ada0ce bit = 0), and then enable the a/d conversion operation (ada0ce bit = 1). ? normal conversion mode ? one-shot select mode/one-shot scan mo de of the high-speed conversion mode
chapter 13 a/d converter user?s manual u16603ej5v1ud 492 13.5 operation 13.5.1 basic operation <1> set the operation mode, trigger mode, and conversion time for executing a/d conversion by using the ada0m0, ada0m1, ada0m2, and ada0s registers. when the ada0ce bit of the ada0m0 register is set, conversion is started in the software trigger mode and the a/d converter waits for a trigger in the external or timer trigger mode. <2> when a/d conversion is started, the voltage input to the selected anal og input channel is sampled by the sample & hold circuit. <3> when the sample & hold circuit samples the input cha nnel for a specific time, it enters the hold status, and holds the input analog voltage until a/d conversion is complete. <4> set bit 9 of the successive approximation regi ster (sar). the tap selector selects (1/2) av ref0 as the voltage tap of the series resistor string. <5> the voltage difference between the voltage of the series resistor st ring and the analog input voltage is compared by the voltage comparator. if th e analog input voltage is higher than (1/2) av ref0 , the msb of the sar register remains set. if it is lower than (1/2) av ref0 , the msb is reset. <6> next, bit 8 of the sar register is automatically set and the next comparison is started. depending on the value of bit 9, to which a result has been already set, t he voltage tap of the series resistor string is selected as follows. ? bit 9 = 1: (3/4) av ref0 ? bit 9 = 0: (1/4) av ref0 this voltage tap and the analog input voltage are compared and, depending on the result, bit 8 is manipulated as follows. analog input voltage voltage tap: bit 8 = 1 analog input voltage voltage tap: bit 8 = 0 <7> this comparison is continued to bit 0 of the sar register. <8> when comparison of the 10 bits is complete, the valid di gital result is stored in t he sar register, which is then transferred to and stored in the ada0crn register. after that, an a/d conversion end interrupt request signal (intad) is generated. <9> in one-shot select mode, conversion is stopped note . in one-shot scan mode, conversion is stopped after scanning once note . in continuous select mode, repeat steps <2> to <8> until the ada0m0.ada0ce bit is cleared to 0. in continuous scan mode, repeat steps <2> to <8> for each channel. note in the external trigger mode, timer trigger mode 0, or timer trigger mode 1, the trigger standby status is entered. remark the trigger standby status me ans the status after the st abilization time has elapsed.
chapter 13 a/d converter user?s manual u16603ej5v1ud 493 13.5.2 conversion op eration timing figure 13-3. conversion operation timing (continuous conversion) (1) operation in normal conversion mode (ada0hs1 bit = 0) ada0m0.ada0ce bit processing state setup stabilization time conversion time wait time sampling first conversion second conversion setup sampling wait a/d conversion intad signal 2/f xx (max.) 0.5/f xx sampling time (2) operation in high-speed con version mode (ada0hs1 bit = 1) ada0m0.ada0ce bit processing state setup conversion time sampling first conversion second conversion sampling a/d conversion a/d conversion intad signal 0.5/f xx stabilization time 2/f xx (max.) sampling time ada0fr3 to ada0fr0 bits note stabilization time conversion time (sampli ng time) wait time trigger response time 0000 13/f xx 26/f xx (4/f xx ) 27/f xx 3/f xx 0001 26/f xx 52/f xx (8/f xx ) 53/f xx 3/f xx 0010 39/f xx 78/f xx (12/f xx ) 79/f xx 3/f xx 0011 50/f xx 104/f xx (16/f xx ) 105/f xx 3/f xx 0100 50/f xx 130/f xx (20/f xx ) 131/f xx 3/f xx 0101 50/f xx 156/f xx (24/f xx ) 157/f xx 3/f xx 0110 50/f xx 182/f xx (28/f xx ) 183/f xx 3/f xx 0111 50/f xx 208/f xx (32/f xx ) 209/f xx 3/f xx 1000 50/f xx 234/f xx (36/f xx ) 235/f xx 3/f xx 1001 50/f xx 260/f xx (40/f xx ) 261/f xx 3/f xx 1010 50/f xx 286/f xx (44/f xx ) 287/f xx 3/f xx 1011 50/f xx 312/f xx (48/f xx ) 313/f xx 3/f xx other than above setting prohibited note v850es/sj2: ada0fr2 to ada0fr0 bits v850es/sj2-h: ada0fr3 to ada0fr0 bits remark the above timings are when a trigger generates within the stabilization time. if the trigger generates after the stabilization time, a trig ger response time is inserted.
chapter 13 a/d converter user?s manual u16603ej5v1ud 494 13.5.3 trigger mode the timing of starting the conversion oper ation is specified by setting a trigger mode. the trigger mode includes a software trigger mode and hardware trigger modes. the hardware trigger modes include timer trigger modes 0 and 1, and external trigger mode. the ada0m0.ada0tmd bit is us ed to set the trigger mode. the hardware trigger modes are set by the ada0m2.ada0tmd1 and ada0m2.ada0tmd0 bits. (1) software trigger mode when the ada0m0.ada0ce bit is set to 1, the signal of the analog input pin (ani0 to ani15 pin) specified by the ada0s register is converted. when conversion is co mplete, the result is stored in the ada0crn register. at the same time, the a/d conversion end in terrupt request signal (intad) is generated. if the operation mode specified by the ada0m0.ada0md1 and ada0m0.ada0md0 bits is the continuous select/scan mode, the next conversion is started, unless the ada0ce bit is cleared to 0 after completion of the first conversion. conversion is performed once and ends if the operation mode is the one-shot select/scan mode. when conversion is started, the ada0m0.ada0ef bit is set to 1 (indicating that conversion is in progress). if the ada0m0, ada0m2, ada0s, ada0pfm, or ada0pft r egister is written during conversion, the conversion is aborted and started again from the beginning. however, writing these registers is prohibited in the normal conversion mode and one-shot select mode/one-s hot scan mode of the high-speed conversion mode. (2) external trigger mode in this mode, converting the signal of the analog input pin (ani0 to ani15) specified by the ada0s register is started when an external trigger is input (to the adtrg pin). which edge of the external trigger is to be detected (i.e., the rising edge, falling edge, or both ri sing and falling edges) can be specified by using the ada0m0.ada0ets1 and ada0m0.ata0ets0 bits. when the ad a0ce bit is set to 1, the a/d converter waits for the trigger, and starts conversion after the external trigger has been input. when conversion is completed, the re sult of conversion is stored in t he ada0crn register, regardless of whether the continuous select, c ontinuous scan, one-shot select, or one-shot scan mode is set as the operation mode by the ada0md1 and ada0md0 bits. at the same time, the intad signal is generated, and the a/d converter waits for the trigger again. when conversion is started, the ada0ef bit is set to 1 (indicating that conversion is in progress). while the a/d converter is waiting for the trigger, however, the ada0ef bit is cleared to 0 (indicating that conversion is stopped). if the valid trigger is input during the conver sion operation, the conversion is aborted and started again from the beginning. if the ada0m0, ada0m2, ada0s, ada0pfm, or ada0pft r egister is written during the conversion operation, the conversion is not aborted, and the a/d converter waits for the trigger again. however, writing these registers is prohibited in the one- shot select mode/one-shot scan mode. caution to select the external trigger mode, set the high-speed conversion mode. do not input a trigger during stabilization time that is inser ted once after the a/d conversion operation is enabled (ada0m0.ada0ce bit = 1). remark the trigger standby status me ans the status after the st abilization time has elapsed.
chapter 13 a/d converter user?s manual u16603ej5v1ud 495 (3) timer trigger mode in this mode, converting the signal of the analog input pin (ani0 to ani15) specified by the ada0s register is started by the compare match interrupt request signal (inttp2cc0 or inttp2cc1) of the capture/compare register connected to the timer. the inttp2cc0 or inttp2cc1 signal is selected by the ada0tmd1 and ada0tmd0 bits, and conversion is started at the rising edge of the specified compare match interrupt request signal. when the ada0ce bit is set to 1, the a/d co nverter waits for a trigger, and starts conversion when the compare match interrupt request signal of the timer is input. when conversion is completed, regardless of whether the continuous select, continuous scan, one-shot select, or one-shot scan mode is set as t he operation mode by the ada0md1 and ada0md0 bits, the result of the conversion is stored in the ada0crn register. at the same time, the intad signal is generated, and the a/d converter waits for the trigger again. when conversion is started, the ada0ef bit is set to 1 (indicating that conversion is in progress). while the a/d converter is waiting for the trigger, however, the ada0ef bit is cleared to 0 (indicating that conversion is stopped). if the valid trigger is input during the conver sion operation, the conversion is aborted and started again from the beginning. if the ada0m0, ada0m2, ada0s, ada0pfm, or ada0pft r egister is written during conversion, the conversion is stopped and the a/d converter waits for the trigger again. however, writing these registers is prohibited in the one-shot select mode/one-shot scan mode. caution to select the timer trigger mode, set the hi gh-speed conversion mode. do not input a trigger during stabilization time that is inserted once after the a/d co nversion operation is enabled (ada0m0.ada0ce bit = 1). remark the trigger standby status me ans the status after the st abilization time has elapsed.
chapter 13 a/d converter user?s manual u16603ej5v1ud 496 13.5.4 operation mode four operation modes are available as t he modes in which to set the ani0 to ani15 pins: continuous select mode, continuous scan mode, one-shot sele ct mode, and one-shot scan mode. the operation mode is selected by the ad a0m0.ada0md1 and ada0m0.ada0md0 bits. (1) continuous select mode in this mode, the voltage of one analog input pin selected by the ada0s register is continuously converted into a digital value. the conversion result is stored in the ada0crn register corresponding to the analog input pin. in this mode, an analog input pin corresponds to an ada0crn register on a one-to-one basis. each time a/d conversion is completed, the a/d conversion end interrupt reques t signal (intad) is generated. after completion of conversion, the next conversion is started, unless the ada0m0.ada0ce bit is cleared to 0 (n = 0 to 15). figure 13-4. timing example of continuous se lect mode operation (ada0s register = 01h) ani1 a/d conversion data 1 ( ani1) data 2 (ani1) data 3 (ani1) data 4 (ani1) data 5 ( ani1) data 6 (ani1) data 7 (ani1) data 1 data 2 data 3 data 4 data 5 data 6 data 7 data 1 (ani1) data 2 (ani1) data 3 (ani1) data 4 (ani1) data 6 (ani1) ada0cr1 intad conversion start set ada0ce bit = 1 conversion start set ada0ce bit = 1 (2) continuous scan mode in this mode, analog input pins are sequentially selected, from the ani0 pin to the pin specified by the ada0s register, and their values are converted into digital values. the result of each conversion is stored in the ada0cr n register corresponding to the analog input pin. when conversion of the analog input pin specified by the ada0 s register is complete, the intad signal is generated, and a/d conversion is started again from the ani0 pin, unless the ada0ce bit is cleared to 0 (n = 0 to 15).
chapter 13 a/d converter user?s manual u16603ej5v1ud 497 figure 13-5. timing example of continuous s can mode operation (ada0s register = 03h) (a) timing example a/d conversion data 1 ( ani0) data 2 (ani1) data 3 (ani2) data 4 (ani3) data 5 (ani0) data 6 ( ani1) data 7 (ani2) data 1 (ani0) data 2 (ani1) data 3 (ani2) data 4 (ani3) data 5 (ani0) data 6 ( ani1) ada0crn intad conversion start set ada0ce bit = 1 ani3 ani0 ani1 ani2 data 1 data 2 data 3 data 4 data 6 data 5 data 7 (b) block diagram a/d converter ada0crn register analog input pin ani0 ani1 ani2 ani3 ani4 ani5 ani13 ani14 ani15 . . . . ada0cr0 ada0cr1 ada0cr2 ada0cr3 ada0cr4 ada0cr5 ada0cr13 ada0cr14 ada0cr15 . . .
chapter 13 a/d converter user?s manual u16603ej5v1ud 498 (3) one-shot select mode in this mode, the voltage on the analog input pin specifie d by the ada0s register is converted into a digital value only once. the conversion result is stored in the ada0crn register corresponding to the analog input pin. in this mode, an analog input pin and an ada0crn register correspond on a one-to-one basis. when a/d conversion has been completed once, the intad signal is generated. the a/d conversion operation is stopped after it has been completed (n = 0 to 15). figure 13-6. timing example of one-shot select mode oper ation (ada0s register = 01h) ani1 a/d conversion data 1 ( ani1) data 6 ( ani1) data 1 data 2 data 3 data 4 data 5 data 6 data 7 data 1 ( ani1) data 6 ( ani1) ada0cr1 intad conversion start set ada0ce bit = 1 conversion start set ada0ce bit = 1 conversion end conversion end (4) one-shot scan mode in this mode, analog input pins are sequentially selected, from the ani0 pin to the pin specified by the ada0s register, and their values are converted into digital values. each conversion result is stored in the ada0crn regi ster corresponding to the analog input pin. when conversion of the analog input pin specified by the ada0s register is complete, the intad signal is generated. a/d conversion is stopped after it has been completed (n = 0 to 15).
chapter 13 a/d converter user?s manual u16603ej5v1ud 499 figure 13-7. timing example of one-shot s can mode operation (ada0s register = 03h) (a) timing example a/d conversion data 1 ( ani0) data 2 ( ani1) data 3 (ani2) data 4 ( ani3) data 1 ( ani0) data 2 (ani1) data 3 (ani2) data 4 (ani3) ada0crn intad conversion start set ada0ce bit = 1 conversion end ani3 ani0 ani1 ani2 data 1 data 2 data 3 data 4 data 6 data 5 data 7 (b) block diagram a/d converter ada0crn register analog input pin ani0 ani1 ani2 ani3 ani4 ani5 ani13 ani14 ani15 . . . . ada0cr0 ada0cr1 ada0cr2 ada0cr3 ada0cr4 ada0cr5 ada0cr13 ada0cr14 ada0cr15 . . .
chapter 13 a/d converter user?s manual u16603ej5v1ud 500 13.5.5 power-fail compare mode the a/d conversion end interrupt re quest signal (intad) c an be controlled as foll ows by the ada0pfm and ada0pft registers. ? when the ada0pfm.ada0pfe bit = 0, the intad signal is generated each time conversion is completed (normal use of the a/d converter). ? when the ada0pfe bit = 1 and when t he ada0pfm.ada0pfc bit = 0, the va lue of the ada0crnh register is compared with the value of the ada0pft register wh en conversion is completed, and the intad signal is generated only if ada0crnh ada0pft. ? when the ada0pfe bit = 1 and when the ada0pfc bit = 1, the value of the ada0cr nh register is compared with the value of the ada0pft register when conversion is completed, and the intad signal is generated only if ada0crnh < ada0pft. remark n = 0 to 15 in the power-fail compare mode, four modes are availabl e as modes in which to set the ani0 to ani15 pins: continuous select mode, continuous scan mode, one-shot select mode, and one-shot scan mode.
chapter 13 a/d converter user?s manual u16603ej5v1ud 501 (1) continuous select mode in this mode, the result of converting the voltage of t he analog input pin specified by the ada0s register is compared with the set value of the ada0pft register. if the result of power-fail comparison matches the condition set by the ada0pfc bit, the conversion result is stored in the ada0crn register, and the intad signal is generated. if it does not match, the conver sion result is stored in the ada0crn register, and the intad signal is not generated. after completion of the fi rst conversion, the next conversion is started, unless the ada0m0.ada0ce bit is cleared to 0 (n = 0 to 15). figure 13-8. timing example of continuous select mode operation (when power-fail comparison is made: ada0s register = 01h) ani1 a/d conversion data 1 ( ani1) data 2 (ani1) data 3 (ani1) data 4 (ani1) data 5 ( ani1) data 6 ( ani1) data 7 ( ani1) data 1 data 2 data 3 data 4 data 5 data 6 data 7 data 1 ( ani1) data 2 ( ani1) data 3 ( ani1) data 4 ( ani1) data 6 ( ani1) ada0cr1 intad conversion start set ada0ce bit = 1 ada0pft unmatch ada0pft unmatch ada0pft match ada0pft match ada0pft match conversion start set ada0ce bit = 1 (2) continuous scan mode in this mode, the results of converting the voltages of the analog input pins sequentially selected from the ani0 pin to the pin specified by the ada0s register are st ored, and the set value of the ada0cr0h register of channel 0 is compared with the value of the ada0pft r egister. if the result of power-fail comparison matches the condition set by the ada0pfc bit, the conversion resu lt is stored in the ada0cr0 register, and the intad signal is generated. if it does not match, the conver sion result is stored in the ada0cr0 register, and the intad signal is not generated. after the result of the first conversion has been stored in the ada0cr0 register, the results of sequentially converting the voltages on the analog input pins up to t he pin specified by the ada0 s register are continuously stored. after completion of conversion, the next conv ersion is started from the ani0 pin again, unless the ada0ce bit is cleared to 0.
chapter 13 a/d converter user?s manual u16603ej5v1ud 502 figure 13-9. timing example of continuous scan mode operation (when power-fail comparison is made: ada0s register = 03h) (b) timing example a/d conversion data 1 ( ani0) data 2 ( ani1) data 3 ( ani2) data 4 ( ani3) data 5 ( ani0) data 6 ( ani1) data 7 ( ani2) data 1 ( ani0) data 2 (ani1) data 3 ( ani2) data 4 ( ani3) data 5 ( ani0) data 6 ( ani1) ada0crn intad conversion start set ada0ce bit = 1 ada0pft match ada0pft unmatch ani3 ani0 ani1 ani2 data 1 data 2 data 3 data 4 data 6 data 5 data 7 (b) block diagram a/d converter ada0crn register analog input pin ani0 ani1 ani2 ani3 ani4 ani5 ani13 ani14 ani15 . . . . ada0cr0 ada0cr1 ada0cr2 ada0cr3 ada0cr4 ada0cr5 ada0cr13 ada0cr14 ada0cr15 . . .
chapter 13 a/d converter user?s manual u16603ej5v1ud 503 (3) one-shot select mode in this mode, the result of converting the voltage of t he analog input pin specified by the ada0s register is compared with the set value of the ada0pft register. if the result of power-fail comparison matches the condition set by the ada0pfc bit, the conversion result is stored in the ada0crn register, and the intad signal is generated. if it does not match, the conver sion result is stored in the ada0crn register, and the intad signal is not generated. conversion is stopped after it has been completed. figure 13-10. timing example of on e-shot select mode operation (when power-fail comparison is made: ada0s register = 01h) ani1 a/d conversion data 1 ( ani1) data 6 ( ani1) data 1 data 2 data 3 data 4 data 5 data 6 data 7 data 1 ( ani1) data 6 ( ani1) ada0cr1 intad conversion start set ada0ce bit = 1 conversion start set ada0ce bit = 1 ada0pft match conversion end ada0pft unmatch conversion end (4) one-shot scan mode in this mode, the results of converting the voltages of the analog input pins sequentially selected from the ani0 pin to the pin specified by the ada0s register are st ored, and the set value of the ada0cr0h register of channel 0 is compared with the set value of the ada0pf t register. if the result of power-fail comparison matches the condition set by the ada0pfc bit, the conver sion result is stored in the ada0cr0 register and the intad signal is generated. if it does not match, the co nversion result is stored in the ada0cr0 register, and the intad0 signal is not generated. after the result of the first conversion has been stored in the ada0cr0 register, the results of converting t he signals on the analog input pins s pecified by the ada0s register are sequentially stored. the conversion is stopped after it has been completed.
chapter 13 a/d converter user?s manual u16603ej5v1ud 504 figure 13-11. timing example of on e-shot scan mode operation (when power-fail comparison is made: ada0s register = 03h) (a) timing example a/d conversion data 1 ( ani0) data 2 ( ani1) data 3 ( ani2) data 4 ( ani3) data 1 ( ani0) data 2 ( ani1) data 3 ( ani2) data 4 ( ani3) ada0crn intad conversion start set ada0ce bit = 1 conversion end ada0pft match ani3 ani0 ani1 ani2 data 1 data 2 data 3 data 4 data 6 data 5 data 7 (b) block diagram a/d converter ada0crn register analog input pin ani0 ani1 ani2 ani3 ani4 ani5 ani13 ani14 ani15 . . . . ada0cr0 ada0cr1 ada0cr2 ada0cr3 ada0cr4 ada0cr5 ada0cr13 ada0cr14 ada0cr15 . . .
chapter 13 a/d converter user?s manual u16603ej5v1ud 505 13.6 cautions (1) when a/d converter is not used when the a/d converter is not used, the power cons umption can be reduced by clearing the ada0m0.ada0ce bit to 0. (2) input range of ani0 to ani15 pins input the voltage within the specified range to the ani0 to ani15 pi ns. if a voltage equal to or higher than av ref0 or equal to or lower than av ss (even within the range of the absolute maximum ratings) is input to any of these pins, the conversion value of that channel is undefined, and the conversion value of the other channels may also be affected. (3) countermeasures against noise to maintain the 10-bit resolution, the ani0 to ani15 pins must be effectively pr otected from noise. the influence of noise increases as the output impedance of the analog input sour ce becomes higher. to lower the noise, connecting an external capacitor as shown in figure 13-12 is recommended. figure 13-12. processing of analog input pin av ref0 v dd v ss av ss clamp with a diode with a low v f (0.3 v or less) if noise equal to or higher than av ref0 or equal to or lower than av ss may be generated. ani0 to ani15
chapter 13 a/d converter user?s manual u16603ej5v1ud 506 (4) alternate i/o the analog input (ani0 to ani15) pins are multiplexed with port pins. the av ref0 power pin is multiplexed with the reference power supply to the a/d converter and the i/o buffer power supply of port 7. if any of the following processings is performed during a/d conversion, therefore, the expected a/d conversion value may not be obtained. (a) if a digital pulse is applied to a pin adjacent to a pin whose input analog signal is converted into a digital signal (for example, p72 and p74 pins during ani3 conversion) (cause: influence of coupling noise) (b) if av ref0 power supply fluctuates as a result of executing an instruction to read the p7h or p7l register to the input port during a/d conversion or an instruction to write data to the output port (cause: influence on the av ref0 power supply) (c) if a current flows through a pin of port 7 (p70 to p 715) that is set in the output mode because of the influence of the external circuit connect ed to the port pin and, as a result, the av ref0 power supply fluctuates (cause: influence on the av ref0 power supply) if there is a possibility that any of the above processings may be executed during a/d conversion, be sure to execute a/d conversion more than once, check the a/d conversion value, and eliminate any abnormal value by program.
chapter 13 a/d converter user?s manual u16603ej5v1ud 507 (5) interrupt request flag (adif) the interrupt request flag (adif) is not cleared even if the contents of the ada0s regi ster are changed. if the analog input pin is changed during a/d co nversion, therefore, the result of converting the previously selected analog input signal may be stored and the conversion end interrupt request flag may be set immediately before the ada0s register is rewritten. if the adif flag is read immediately after the ada0s register is rewritten, the adif flag may be set even though the a/d conversion of the newly selected analog input pin has not been completed. when a/d conversion is stopped, cl ear the adif flag before resuming conversion. figure 13-13. generation timing of a/d conversion end interrupt request ada0s rewriting (anin conversion start) ada0s rewriting (anim conversion start) adif is set, but anim conversion does not end a/d conversion ada0crn intad anin anin anim anim anim anin anin anim remark n = 0 to 15 m = 0 to 15 (6) internal equivalent circuit the following shows the equivalent circuit of the analog input block. figure 13-14. internal equi valent circuit of anin pin anin c in r in r in c in 2.9 k 4.0 pf remarks 1. the above values are reference values. 2. n = 0 to 15
chapter 13 a/d converter user?s manual u16603ej5v1ud 508 (7) av ref0 pin (a) the av ref0 pin is used as the power supply pin of the a/d converter and also supplies power to the alternate-function ports. in an application where a backup power supply is used, be sure to supply the same voltage as v dd to the av ref0 pin as shown in figure 13-15. (b) the av ref0 pin is also used as the reference voltage pin of the a/d converter. if the source supplying power to the av ref0 pin has a high impedance or if the power supply has a low current supply capability, the reference voltage may fluctuate due to the current that flows during conversion (especially, immediately after the conversion operation enable bit ada0ce has been set to 1). as a result, the conversion accuracy may drop. to avoid this, it is recommended to connect a capacitor across the av ref0 and av ss pins to suppress the reference voltage fluctuation as shown in figure 13-15. (c) if the source supplying power to the av ref0 pin has a high dc resistance (for example, because of insertion of a diode), the voltage when conversion is enabled may be lower than the voltage when conversion is stopped, because of a voltage drop caused by the a/d conversion current. figure 13-15. av ref0 pin processing example av ref0 note av ss main power supply note parasitic inductance (8) reading ada0crn register when the ada0m0 to ada0m2, ada0s, ada0pfm, or ad a0pft register is writt en, the contents of the ada0crn register may be undefined. read the conver sion result after completion of conversion and before writing to the ada0m0 to ada0m2, ada0s, ada0pfm, or ada0pft register. also, when an external/timer trigger is acknowledged, the contents of the ada0crn register may be undefined. read the conversion result after completion of conversion and before the next external/timer trigger is acknowledged. the correct conversion result may not be read at a timing different from the above. (9) standby mode because the a/d converter stops operating in the stop mode, conversion results are invalid, so power consumption can be reduced. operations are resume d after the stop mode is released, but the a/d conversion results after the stop mode is released are invalid. when using the a/d converter after the stop mode is released, before setting the stop mode or releasing the stop mode, clear the ada0m0.ada0ce bit to 0 then set the ada0ce bit to 1 after releasing the stop mode. in the idle1, idle2, or subclock operation mode, oper ation continues. to lower the power consumption, therefore, clear the ada0m0.ada0ce bit to 0. in the idle1 and idle2 modes, since the analog input voltage value cannot be retained, the a/d conversion results a fter the idle1 and idle2 modes are released are invalid. the results of conversions before the id le1 and idle2 modes were set are valid.
chapter 13 a/d converter user?s manual u16603ej5v1ud 509 (10) restriction for each mode (a) to select the external trigger mode/timer trigger mode, set the high-speed conversion mode. do not input a trigger during stabilization time that is insert ed once after the a/d conversion operation is enabled (ada0m0.ada0ce bit = 1). (b) in the following modes, write data to the a/d cont rol register while a/d conversion is stopped (ada0ce bit = 0), and then enable the a/d conversion operation (ada0ce bit = 1). ? normal conversion mode ? one-shot select mode/one-shot sc an mode of high-speed conversion mode remark a/d control registers: ada0m0, ada0m2, ada0s, ada0pfm, and ada0pft registers (11) variation of a/d conversion results the results of the a/d conversion may vary depending on the fluctuation of the supply voltage, or may be affected by noise. to reduce the vari ation, take counteractive measures with the program such as averaging the a/d conversion results. (12) a/d conversion result hysteresis characteristics the successive comparison type a/d converter holds t he analog input voltage in the internal sample & hold capacitor and then performs a/d conversi on. after the a/d conversion ha s finished, the analog input voltage remains in the internal sample & hold capacitor. as a result, the following phenomena may occur. ? when the same channel is used for a/d conversions, if th e voltage is higher or lower than the previous a/d conversion, then hysteresis characteristics may appear where the conversion result is affected by the previous value. thus, even if t he conversion is performed at the same potential, the result may vary. ? when switching the analog input channel, hysteres is characteristics may appear where the conversion result is affected by the previous channel value. this is because one a/d converter is used for the a/d conversions. thus, even if the conversion is perfo rmed at the same potential, the result may vary.
chapter 13 a/d converter user?s manual u16603ej5v1ud 510 13.7 how to read a/d converter characteristics table this section describes the terms related to the a/d converter. (1) resolution the minimum analog input voltage that c an be recognized, i.e., the ratio of an analog input voltage to 1 bit of digital output is called 1 lsb (least significant bit). the ratio of 1 lsb to the full scale is expressed as %fsr (full-scale range). %fsr is the ratio of a range of convertible analog input voltages expressed as a percentage, and can be expressed as follows, independently of the resolution. 1%fsr = (maximum value of convertible analog input voltage ? minimum value of convertible analog input voltage)/100 = (av ref0 ? 0)/100 = av ref0 /100 when the resolution is 10 bits, 1 lsb is as follows: 1 lsb = 1/2 10 = 1/1,024 = 0.098%fsr the accuracy is determined by the overall error, independently of the resolution. (2) overall error this is the maximum value of the difference between an actually measured value and a theoretical value. it is a total of zero-scale error, full-scale error, linearity error, and a combination of these errors. the overall error in the characteristics ta ble does not include the quantization error. figure 13-16. overall error ideal line overall error 1 ...... 1 0 ...... 0 0av ref0 analog input digital output
chapter 13 a/d converter user?s manual u16603ej5v1ud 511 (3) quantization error this is an error of 1/2 lsb that inevitably occurs when an analog value is converted into a digital value. because the a/d converter converts analog input voltages in a range of 1/2 lsb into the same digital codes, a quantization error is unavoidable. this error is not included in the overall error, zero-scale error, full-scale error, integral linearity error, or differential linearity error in the characteristics table. figure 13-17. quantization error quantization error 1 ...... 1 0 ...... 0 0av ref0 analog input digital output 1/2 lsb 1/2 lsb (4) zero-scale error this is the difference between the actually measured analog input volt age and its theoretical value when the digital output changes from 0?000 to 0?001 (1/2 lsb). figure 13-18. zero-scale error av ref0 analog input (lsb) digital output (lower 3 bits) ideal line 111 ? 10123 100 011 010 001 000 zero-scale error
chapter 13 a/d converter user?s manual u16603ej5v1ud 512 (5) full-scale error this is the difference between the actually measured analog input volt age and its theoretical value when the digital output changes from 1?110 to 1?111 (full scale ? 3/2 lsb). figure 13-19. full-scale error av ref0 analog input (lsb) digital output (lower 3 bits) 111 av ref0 ? 3 0 av ref0 ? 2av ref0 ? 1 100 011 010 000 full-scale error (6) differential linearity error ideally, the width to output a specific code is 1 lsb. th is error indicates the difference between the actually measured value and its theoretical value when a sp ecific code is output. this indicates the basic characteristics of the a/d conversion when the voltage applied to the analog input pins of the same channel is consistently increased bit by bit from av ss to av ref0 . when the input voltage is increased or decreased, or when two or more channels are used, see 13.7 (2) overall error . figure 13-20. differential linearity error ideal width of 1 lsb differential linearity error 1 ...... 1 0 ...... 0 av ref0 analog input digital output
chapter 13 a/d converter user?s manual u16603ej5v1ud 513 (7) integral linearity error this error indicates the extent to which the conversion char acteristics differ from the ideal linear relationship. it indicates the maximum value of the difference between the actually measured valu e and its theoretical value where the zero-scale error and full-scale error are 0. figure 13-21. integral linearity error 1 ...... 1 0 ...... 0 0av ref0 analog input digital output ideal line integral linearity error (8) conversion time this is the time required to obtain a digital output after each trigger has been generated. the conversion time in the characteristics table includes the sampling time. (9) sampling time this is the time for which the analog switch is on to load an analog voltage to the sample & hold circuit. figure 13-22. sampling time sampling time conversion time
user?s manual u16603ej5v1ud 514 chapter 14 d/a converter 14.1 functions the d/a converter has the following functions. { 8-bit resolution 2 channels (da0cs0, da0cs1) { r-2r ladder method { settling time: 3 s max. (when av ref1 is 3.0 to 3.6 v and external load is 20 pf) { analog output voltage: av ref1 m/256 (m = 0 to 255; value set to da0csn register) { operation modes: normal mo de, real-time output mode remark n = 0, 1
chapter 14 d/a converter user?s manual u16603ej5v1ud 515 14.2 configuration the d/a converter configur ation is shown below. figure 14-1. block diagram of d/a converter da0cs0 register selector selector da0cs1 register ano0 pin ano1 pin da0m.da0ce0 bit da0m.da0ce1 bit da0cs0 register write da0m.da0md0 bit inttp2cc0 signal da0cs1 register write da0m.da0md1 bit inttp3cc0 signal av ref1 pin av ss pin cautions 1. da converters 0 and 1 share the av ref1 pin. 2. da converters 0 and 1 share the av ss pin. the av ss pin is also shared by the a/d converter. the d/a converter consists of the following hardware. table 14-1. configuration of d/a converter item configuration control registers d/a converter mode register (da0m) d/a converter conversion value setting registers 0, 1 (da0cs0, da0cs1)
chapter 14 d/a converter user?s manual u16603ej5v1ud 516 14.3 registers the registers that control the d/ a converter are as follows. ? d/a converter mode register (da0m) ? d/a converter conversion value setting registers 0, 1 (da0cs0, da0cs1) (1) d/a converter mode register (da0m) the da0m register controls the operation of the d/a converter. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 normal mode real-time output mode note da0mdn 0 1 selection of d/a converter operation mode (n = 0, 1) da0m 0 da0ce1 da0ce0 0 0 da0md1 da0md0 after reset: 00h r/w address: fffff282h disables operation enables operation da0cen 0 1 control of d/a converter operation enable/disable (n = 0, 1) < > < > note the output trigger in the real-time outpu t mode (da0mdn bit = 1) is as follows. ? when n = 0: inttp2cc0 signal (see chapter 7 16-bit timer/event counter p (tmp) ) ? when n = 1: inttp3cc0 signal (see chapter 7 16-bit timer/event counter p (tmp) ) (2) d/a converter conversion value setti ng registers 0, 1 (da0cs0, da0cs1) the da0cs0 and da0cs1 registers set the analog volt age value output to the ano0 and ano1 pins. these registers can be read or written in 8-bit units. reset sets these registers to 00h. da0csn7 da0csn da0csn6 da0csn5 da0csn4 da0csn3 da0csn2 da0csn1 da0csn0 after reset: 00h r/w address: da0cs0 fffff280h, da0cs1 fffff281h caution in the real-time output mode (da0m.da0mdn bit = 1), set the da0csn register before the inttp2cc0/inttp3cc0 signals are generate d. d/a conversion starts when the inttp2cc0/inttp3cc0 signa ls are generated. remark n = 0, 1
chapter 14 d/a converter user?s manual u16603ej5v1ud 517 14.4 operation 14.4.1 operation in normal mode d/a conversion is performed using a write operation to the da0csn register as the trigger. the setting method is described below. <1> set the da0m.da0mdn bit to 0 (normal mode). <2> set the analog voltage value to be output to the anon pin to the da0csn register. steps <1> and <2> above constitute the initial settings. <3> set the da0m.da0cen bit to 1 (d/a conversion enable). d/a conversion starts when this setting is performed. <4> to perform subsequent d/a conversions, write to the da0csn register. the previous d/a conversion result is held until the next d/a conversion is performed. remarks 1. for the alternate-function pin settings, see table 4-19 using port pin as alternate-function pin . 2. n = 0, 1 14.4.2 operation in real-time output mode d/a conversion is performed using the interrupt reques t signals (inttp2cc0 and inttp3cc0) of tmp2 and tmp3 as triggers. the setting method is described below. <1> set the da0m.da0mdn bit to 1 (real-time output mode). <2> set the analog voltage value to be output to the anon pin to the da0csn register. <3> set the da0m.da0cen bit to 1 (d/a conversion enable). steps <1> to <3> above consti tute the initial settings. <4> operate tmp2 and tmp3. <5> d/a conversion starts when the inttp2cc0 and inttp3cc0 signals are generated. <6> after that, the value set in da0csn register is out put every time the inttp2cc0 and inttp3cc0 signals are generated. remarks 1. the output values of the ano0 and ano1 pins up to <5> above are undefined. 2. for the output values of the ano0 and ano1 pi ns in the halt, idle1, idle2, and stop modes, see chapter 24 standby function . 3. for the alternate-function pin settings, see table 4-19 using port pin as alternate-function pin .
chapter 14 d/a converter user?s manual u16603ej5v1ud 518 14.4.3 cautions observe the following cautions when using the d/a converter of the v850es/sj2. (1) do not change the set value of the da0csn register while the trigger signal is being issued in the real-time output mode. (2) before changing the operation mode, be sure to clear the da0m.da0cen bit to 0. (3) when using one of the p10/an00 and p11/an01 pins as an i/o port and the other as a d/ a output pin, do so in an application where the port i/o level does not change during d/a output. (4) make sure that av ref0 = v dd = av ref1 = 3.0 to 3.6 v. if this range is exceeded, the operation is not guaranteed. (5) apply power to av ref1 at the same timing as av ref0 . (6) no current can be output from the anon pin (n = 0, 1) because the output impedanc e of the d/a converter is high. when connecting a resistor of 2 m or less, insert a jfet input operational amplifier between the resistor and the anon pin. figure 14-2. external pin connection example av ref1 v dd output 10 f 0.1 f 10 f 0.1 f av ref0 anon av ss ? + jfet input operational amplifier (7) because the d/a converter stops operation in the stop mode, the ano0 and ano1 pins go into a high- impedance state, and the power consumption can be reduced. in the idle1, idle2, or subclock operation mode, however, the operation continues. to lower the power consumption, therefore, clear the da0m.da0cen bit to 0.
user?s manual u16603ej5v1ud 519 chapter 15 asynchronous ser ial interface a (uarta) 15.1 mode switching of uarta and other serial interfaces 15.1.1 csib4 and uarta0 mode switching in the v850es/sj2 and v850es/sj2-h, cs ib4 and uarta0 are alternate functions of the same pin and therefore cannot be used simultaneously. set uarta0 in advanc e, using the pmc3 and pfc3 registers, before use. caution the transmit/receive operation of csib4 and uarta0 is not guaranteed if these functions are switched during transmission or reception. be su re to disable the one that is not used. figure 15-1. csib4 and uarta0 mode switch settings pmc3 after reset: 0000h r/w address: fffff446h, fffff447h pmc37 pmc36 pmc35 pmc34 pmc33 pmc32 pmc31 pmc30 0 0 0 0 0 0 pmc39 pmc38 8 9 10 11 12 13 14 15 pfc3 after reset: 0000h r/w address: fffff466h, fffff467h 0 0 0 0 0 0 pfc39 pfc38 pfc37 pfc36 pfc35 pfc34 pfc33 pfc32 pfc31 pfc30 8 9 10 11 12 13 14 15 pfce3l after reset: 00h r/w address: fffff706h 0 0 0 pfce34 pfce33 pfce32 0 0 port i/o mode ascka0 mode sckb4 mode port i/o mode uarta0 mode csib4 mode pmc32 0 1 1 pmc3n 0 1 1 operation mode operation mode pfce32 0 0 pfc32 0 1 pfc3n 0 1 remarks 1. n = 0, 1 2. = don?t care
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 520 15.1.2 uarta2 and i 2 c00 mode switching in the i 2 c bus versions (y products) of the v 850es/sj2 and v850es/sj2-h, uarta2 and i 2 c00 are alternate functions of the same pin and therefore cannot be used simu ltaneously. set uarta2 in advance, using the pmc3 and pfc3 registers, before use. caution the transmit/receive operation of uarta2 and i 2 c00 is not guaranteed if these functions are switched during transmission or reception. be sure to disable the one that is not used. figure 15-2. uarta2 and i 2 c00 mode switch settings pmc3 after reset: 0000h r/w address: fffff446h, fffff447h pmc37 pmc36 pmc35 pmc34 pmc33 pmc32 pmc31 pmc30 0 0 0 0 0 0 pmc39 pmc38 8 9 10 11 12 13 14 15 pfc3 after reset: 0000h r/w address: fffff466h, fffff467h 0 0 0 0 0 0 pfc39 pfc38 pfc37 pfc36 pfc35 pfc34 pfc33 pfc32 pfc31 pfc30 8 9 10 11 12 13 14 15 port i/o mode uarta2 mode i 2 c00 mode pmc3n 0 1 1 operation mode pfc3n 0 1 remarks 1. n = 8, 9 2. = don?t care
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 521 15.1.3 uarta1 and i 2 c02 mode switching in the i 2 c bus versions (y products) of the v 850es/sj2 and v850es/sj2-h, uarta1 and i 2 c02 are alternate functions of the same pin and therefor e cannot be used simultaneously. set uarta1 in advance, using the pmc9, pfc9, and pmce9 registers, before use. caution the transmit/receive operation of uarta1 and i 2 c02 is not guaranteed if these functions are switched during transmission or reception. be sure to disable the one that is not used. figure 15-3. uarta1 and i 2 c02 mode switch settings pmc9 after reset: 0000h r/w address: fffff452h, fffff453h pmc97 pmc96 pmc95 pmc94 pmc93 pmc92 pmc91 pmc90 pmc915 pmc914 pmc913 pmc912 pmc911 pmc910 pmc99 pmc98 8 9 10 11 12 13 14 15 pfc9 after reset: 0000h r/w address: fffff472h, fffff473h pfc915 pfc914 pfc913 pfc912 pfc911 pfc910 pfc99 pfc98 pfc97 pfc96 pfc95 pfc94 pfc93 pfc92 pfc91 pfc90 8 9 10 11 12 13 14 15 pfce915 pfce914 0 0 0 0 0 0 pfce97 pfce96 pfce95 pfce94 pfce93 pfce92 pfce91 pfce90 8 9 10 11 12 13 14 15 pfce9 after reset: 0000h r/w address: fffff712h, fffff713h uarta1 mode i 2 c02 mode pmc9n 1 1 operation mode pfce9n 1 1 pfc9n 0 1 remark n = 0, 1
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 522 15.2 features { transfer rate: 300 bps to 312.5 kbps (v850es/sj2: using internal system clock of 20 mhz, v850es/sj2-h: using internal system clock of 32 mhz, and dedicated baud rate generator) { full-duplex communication: internal uartan receive data register (uanrx) internal uartan transmit data register (uantx) { 2-pin configuration: txdan: transmit data output pin rxdan: receive data input pin { reception error output function ? parity error ? framing error ? overrun error { interrupt sources: 2 ? reception completion interrupt (intuanr): this in terrupt occurs upon transfer of receive data from the receive shift register to the uanr x register after serial transfer completion, in the reception enabled status. ? transmission enable interrupt (intuant): this interr upt occurs upon transfer of transmit data from the uantx register to the transmit shift register in the transmission enabled status. { character length: 7, 8 bits { parity function: odd, even, 0, none { transmission stop bit: 1, 2 bits { on-chip dedicated baud rate generator { msb-/lsb-first transfer selectable { transmit/receive data inverted input/output possible { sbf (sync break field) transmission/reception in the li n (local interconnect network) communication format ? 13 to 20 bits selectable for the sbf transmission ? recognition of 11 bits or more possible for sbf reception ? sbf reception flag provided remark n = 0 to 3
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 523 15.3 configuration the block diagram of the uartan is shown below. figure 15-4. block diagram of a synchronous serial interface an internal bus internal bus uanopt0 uanctl0 uanstr uanctl1 uanctl2 receive shift register uanrx filter selector uantx transmit shift register transmission controller reception controller selector baud rate generator baud rate generator intuanr signal intuant signal txdan pin rxdan pin f xx to f xx /2 10 ascka0 note reception unit transmission unit clock selector note uarta0 only remarks 1. n = 0 to 3 2. for the configuration of the baud rate generator, see figure 15-16 . uartan consists of the following hardware units. table 15-1. configuration of uartan item configuration registers uartan control register 0 (uanctl0) uartan control register 1 (uanctl1) uartan control register 2 (uanctl2) uartan option control register 0 (uanopt0) uartan status register (uanstr) uartan receive shift register uartan receive data register (uanrx) uartan transmit shift register uartan transmit data register (uantx)
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 524 (1) uartan control register 0 (uanctl0) the uanctl0 register is an 8-bit register used to specify the uartan operation. (2) uartan control register 1 (uanctl1) the uanctl1 register is an 8-bit register used to select the input clock for the uartan. (3) uartan control register 2 (uanctl2) the uanctl2 register is an 8-bit register us ed to control the baud rate for the uartan. (4) uartan option control register 0 (uanopt0) the uanopt0 register is an 8-bit register used to control serial transfer for the uartan. (5) uartan status register (uanstr) the uanstrn register consists of fl ags indicating the error contents when a reception error occurs. each one of the reception error flags is set (to 1) upon occurrence of a reception error. (6) uartan receive shift register this is a shift register used to convert the serial data input to the rxdan pin into parallel data. upon reception of 1 byte of data and detection of the stop bit, the receive data is transferred to the uanrx register. this register cannot be manipulated directly. (7) uartan receive data register (uanrx) the uanrx register is an 8-bit register that holds receiv e data. when 7 characters are received, 0 is stored in the highest bit (when data is received lsb first). in the reception enabled status, receive data is transfe rred from the uartan receive shift register to the uanrx register in synchronization with the comple tion of shift-in processing of 1 frame. transfer to the uanrx register also causes the recept ion completion interrupt request signal (intuanr) to be output. (8) uartan transmit shift register the transmit shift register is a shift register used to convert the parallel data transferred from the uantx register into serial data. when 1 byte of data is transferred from the uantx register, the shift register data is output from the txdan pin. this register cannot be manipulated directly. (9) uartan transmit data register (uantx) the uantx register is an 8-bit transmit data buffer. transmission starts when transmit data is written to the uantx register. when data can be wri tten to the uantx register (when dat a of one frame is transferred from the uantx register to the uartan transmit shift regi ster), the transmission enable interrupt request signal (intuant) is generated.
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 525 15.4 registers (1) uartan control register 0 (uanctl0) the uanctl0 register is an 8-bit register that c ontrols the uartan serial transfer operation. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 10h. (1/2) uanpwr disable uartan operation (uartan reset asynchronously) enable uartan operation uanpwr 0 1 uartan operation control uanctl0 (n = 0 to 3) uantxe uanrxe uandir uanps1 uanps0 uancl uansl <6> <5> <4> 3 2 1 after reset: 10h r/w address: ua0ctl0 fffffa00h, ua1ctl0 fffffa10h, ua2ctl0 fffffa20h, ua3ctl0 fffffa30h the uartan operation is controlled by the uanpwr bit. the txdan pin output is fixed to high level by clearing the uanpwr bit to 0 (fixed to low level if uanopt0.uantdl bit = 1). disable transmission operation enable transmission operation uantxe 0 1 transmission operation enable <7> 0 ? to start transmission, set the uanpwr bit to 1 and then set the uantxe bit to 1. ? to initialize the transmission unit, clear the uantxe bit to 0, wait for two cycles of the base clock (f uclk ), and then set the uantxe bit to 1 again. otherwise, initialization may not be executed (for the base clock, see 15.7 (1) (a) base clock ). ? when the operation is enabled (uanpwr bit = 1), the transmission operation is enabled after two or more cycles of the base clock (f uclk ) have elapsed since uantxe = 1. ? when the uanpwr bit is cleared to 0, the status of the internal circuit becomes the same status as uantxe bit = 0 by the uanpwr bit even if the uantxe bit is 1. the transmission operation is enabled when the uanpwr bit is set to 1 again.
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 526 (2/2) 7 bits 8 bits uancl note 0 1 specification of data character length of 1 frame of transmit/receive data 1 bit 2 bits uansl note 0 1 specification of length of stop bit for transmit data only the first bit of the receive data stop bits is checked, regardless of the value of the uansl bit. ? if ?reception with 0 parity? is selected during reception, a parity check is not performed. therefore, the uanstr.uanpe bit is not set. ? when transmission and reception are performed in the lin format, clear the uanps1 and uanps0 bits to 00. no parity output 0 parity output odd parity output even parity output reception with no parity reception with 0 parity odd parity check even parity check uanps1 note 0 0 1 1 parity selection during transmission parity selection during reception uanps0 note 0 1 0 1 msb-first transfer lsb-first transfer uandir note 0 1 transfer direction selection disable reception operation enable reception operation uanrxe 0 1 reception operation enable ? to start reception, set the uanpwr bit to 1 and then set the uanrxe bit to 1. ? to initialize the reception unit, clear the uanrxe bit to 0, wait for two cycles of the base clock, and then set the uanrxe bit to 1 again. otherwise, initialization may not be executed (for the base clock, see 15.7 (1) (a) base clock ). ? when the operation is enabled (uanpwr bit = 1), the reception operation is enabled after two or more cycles of the base clock (f uclk ) have elapsed since uanrxe = 1. if the start bit is received before the reception operation is enabled, the start bit is ignored. ? when the uanpwr bit is cleared to 0, the status of the internal circuit becomes the same status as uanrxe bit = 0 by the uanpwr bit even if the uanrxe bit is 1. the reception operation is enabled when the uanpwr bit is set to 1 again. note this register can be rewritten only when the uanpwr bit = 0 or the uantxe bit = uanrxe bit = 0. however, setting any or all of the uanpwr, uantxe, and uanrxe bits to 1 at the same time is possible. remark for details of parity, see 15.6.9 parity types and operations .
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 527 (2) uartan control register 1 (uanctl1) for details, see 15.7 (2) uartan control register 1 (uanctl1) . (3) uartan control register 2 (uanctl2) for details, see 15.7 (3) uartan control register 2 (uanctl2) . (4) uartan option control register 0 (uanopt0) the uanopt0 register is an 8-bit regist er that controls the serial transfer operation of the uartan register. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 14h. caution do not set the uansrt and uanstt bits (to 1) during sbf reception (uansrf bit = 1). (1/2) uansrf when the uanctl0.uanpwr bit = uanctl0.uanrxe bit = 0 are set. also upon normal end of sbf reception. during sbf reception uansrf 0 1 sbf reception flag uanopt0 (n = 0 to 3) uansrt uanstt uansls2 uansls1 uansls0 uantdl uanrdl 654321 after reset: 14h r/w address: ua0opt0 fffffa03h, ua1opt0 fffffa13h, ua2opt0 fffffa23h, ua3opt0 fffffa33h sbf reception trigger uansrt 0 1 sbf reception trigger ? sbf (sync brake field) reception is judged during lin communication. ? the uansrf bit is held at 1 when an sbf reception error occurs, and then sbf reception is started again. ? this is the sbf reception trigger bit during lin communication, and when read, ?0? is always read. for sbf reception, set the uansrt bit (to 1) to enable sbf reception. ? set the uansrt bit after setting both the uanpwr bit and uanrxe bit to 1. ? set the uansrt bit (to 1) during a period of 1 bit after the reception end interrupt request signal (intuanr) has been generated. (if this bit is set (to 1) during reception operation, the uansrf bit is cleared when reception of the current data is completed, even if sbf is not received.) ? writing 0 to the uansrt bit is valid. if 0 is written to the uansrt bit before sbf reception is started, therefore, sbf is not received but normal uart reception is executed. if 0 is written to the uanopt0 register during sbf reception, data that has already been received is received as sbf. if the data being received is not sbf, however, the following data operate as the receive data of uart, starting from the next receive data. the uansrf bit is cleared when 0 is written to the uansrt bit. <7> 0 ?
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 528 (2/2) uansls2 1 1 1 0 0 0 0 1 uansls1 0 1 1 0 0 1 1 0 uansls0 1 0 1 0 1 0 1 0 13-bit output (reset value) 14-bit output 15-bit output 16-bit output 17-bit output 18-bit output 19-bit output 20-bit output sbf transmit length selection ? the output level of the txdan pin can be inverted using the uantdl bit. ? this register can be set when the uanpwr bit = 0 or when the uantxe bit = 0. this register can be set when the uanpwr bit = 0 or when the uantxe bit = 0. normal output of transfer data inverted output of transfer data uantdl 0 1 transmit data level bit ? the input level of the rxdan pin can be inverted using the uanrdl bit. ? this register can be set when the uanpwr bit = 0 or the uanrxe bit = 0. ? when the uanrdl bit is set to 1 (inverted input of receive data), reception must be enabled (uanrxe bit = 1) after setting the data reception pin to the uart reception pin (rxdan) when reception is started. when the pin mode is changed after reception is enabled, the start bit will be mistakenly detected if the pin level is high. normal input of transfer data inverted input of transfer data uanrdl 0 1 receive data level bit ? this is the sbf transmission trigger bit during lin communication, and when read, ?0? is always read. ? set the uanstt bit after setting the uanpwr bit = uantxe bit = 1. ? writing 0 to the uanstt bit is valid. if 0 is written to this bit after 1 has been written to it and before it is sampled with the base clock, sbf transmission is therefore not executed. if 0 is written to the uanstt bit during sbf transmission, the uanstr.uantsf bit is cleared to 0 even though sbf transmission is executed. sbf transmission trigger uanstt 0 1 sbf transmission trigger ?
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 529 (5) uartan status register (uanstr) the uanstr register is an 8-bit register that displays t he uartan transfer status and reception error contents. this register can be read or written in 8-bit or 1-bi t units, but the uantsf bit is a read-only bit, while the uanpe, uanfe, and uanove bits can both be read and written. however, these bits can only be cleared by writing 0; they cannot be set by writing 1 (even if 1 is written to them, the value is retained). the initialization conditions are shown below. register/bit initialization conditions uanstr register ? reset ? uanctl0.uanpwr = 0 uantsf bit ? uanctl0.uantxe = 0 uanpe, uanfe, uanove bits ? 0 write ? uanctl0.uanrxe = 0 caution be sure to read the er ror flags of the uanpe, uanfe, an d uanove bits to check the flag status, and then clear the flags by writing ?0? to them.
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 530 uantsf ? when the uanpwr bit = 0 or the uantxe bit = 0 has been set. ? when, following transfer completion, there was no next data transfer from uantx register write to uantx register uantsf 0 1 transfer status flag uanstr (n = 0 to 3) 0 0 0 0 uanpe uanfe uanove 6 5 4 3 <2> <1> after reset: 00h r/w address: ua0str fffffa04h, ua1str fffffa14h, ua2str fffffa24h, ua3str fffffa34h the uantsf bit is always 1 when performing continuous transmission. when initializing the transmission unit, check that the uantsf bit = 0 before performing initialization. the transmit data is not guaranteed when initialization is performed while the uantsf bit = 1. ? when the uanpwr bit = 0 or the uanrxe bit = 0 has been set. ? when 0 has been written when parity of data and parity bit do not match during reception. uanpe 0 1 parity error flag ? the operation of the uanpe bit is controlled by the settings of the uanctl0.uanps1 and uanctl0.uanps0 bits. ? the uanpe bit can be read and written, but it can only be cleared by writing 0 to it, and it cannot be set by writing 1 to it. when 1 is written to this bit, the value is retained. ? when the uanpwr bit = 0 or the uanrxe bit = 0 has been set ? when 0 has been written when no stop bit is detected during reception uanfe 0 1 framing error flag ? only the first bit of the receive data stop bits is checked, regardless of the value of the uanctl0.uansl bit. ? the uanfe bit can be both read and written, but it can only be cleared by writing 0 to it, and it cannot be set by writing 1 to it. when 1 is written to this bit, the value is retained . ? when the uanpwr bit = 0 or the uanrxe bit = 0 has been set. ? when 0 has been written when receive data has been set to the uanrx register and the next receive operation is completed before that receive data has been read uanove 0 1 overrun error flag ? when an overrun error occurs, the data is discarded without the next receive data being written to the uanrx register. ? the uanove bit can be both read and written, but it can only be cleared by writing 0 to it. when 1 is written to this bit, the value is retained . <7> <0>
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 531 (6) uartan receive data register (uanrx) the uanrx register is an 8-bit buffer r egister that stores parallel data conver ted by the receive shift register. the data stored in the receive shift register is transfe rred to the uanrx register upon completion of reception of 1 byte of data. the reception end interrupt r equest signal (intuanr) is generated in this timing. during lsb-first reception when the data length has been s pecified as 7 bits, the receive data is transferred to bits 6 to 0 of the uanrx register and the msb always becomes 0. during msb-first reception, the receive data is transferred to bits 7 to 1 of the uanrx register and the lsb always becomes 0. when an overrun error occurs (uanstr.uanove bit = 1), the re ceive data at this time is not transferred to the uanrx register and is discarded. this register is read-only, in 8-bit units. in addition to reset input, the uanrx register can be set to ffh by clearing the uanctl0.uanpwr bit to 0. uanrx (n = 0 to 3) 654321 after reset: ffh r address: ua0rx fffffa06h, ua1rx fffffa16h, ua2rx fffffa26h, ua3rx fffffa36h 7 0 (7) uartan transmit data register (uantx) the uantx register is an 8-bit register used to set transmit data. transmission starts when transmit data is written to t he uantx register in the transmission enabled status (uanctl0.uantxe bit = 1). when the data of the uantx register has been transferred to the transmit shift register, the transmission enable interr upt request signal (intuant) is generated. this register can be read or written in 8-bit units. reset sets this register to ffh. uantx (n = 0 to 3) 654321 after reset: ffh r/w address: ua0tx fffffa07h, ua1tx fffffa17h, ua2tx fffffa27h, ua3tx fffffa37h 7 0
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 532 15.5 interrupt request signals the following two interrupt request signals are generated from uartan. ? reception completion interrupt request signal (intuanr) ? transmission enable interrupt request signal (intuant) the default priority for these two interrupt request signals is reception completion interrupt request signal then transmission enable interrupt request signal. table 15-2. interrupts a nd their default priorities interrupt priority reception complete high transmission enable low (1) reception completion interr upt request signal (intuanr) a reception completion interrupt request signal is output when data is shifted into the receive shift register and transferred to the uanrx register in the reception enabled status. when a reception completion interrupt request signal is received and the data is read, read the uanstr register and check that the rec eption result is not an error. no reception completion interrupt request signal is generated in the reception disabled status. (2) transmission enable interr upt request signal (intuant) if transmit data is transferred from the uantx register to the uartan transmit shift register with transmission enabled, the transmission enable interrupt request signal is generated.
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 533 15.6 operation 15.6.1 data format full-duplex serial data reception and transmission is performed. as shown in figure 15-5, one data frame of transmit/receive data consists of a start bit, character bits, parity bit, and stop bit(s). specification of the character bit length within 1 data frame, parity selection, s pecification of the stop bit length, and specification of msb/lsb-first transfer ar e performed using the uanctl0 register. moreover, control of uart output/inverted output for t he txdan bit is performed using the uanopt0.uantdl bit. ? start bi t ................. 1 bit ? character bits........ 7 bits/8 bits ? parity bit ................ even parity/o dd parity/0 parity/no parity ? stop bit .................. 1 bit/2 bits
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 534 figure 15-5. uarta transmit/receive data format (a) 8-bit data length, lsb first, even parity, 1 stop bit, transfer data: 55h 1 data frame start bit d0 d1 d2 d3 d4 d5 d6 d7 parity bit stop bit (b) 8-bit data length, msb first, even parity, 1 stop bit, transfer data: 55h 1 data frame start bit d7 d6 d5 d4 d3 d2 d1 d0 parity bit stop bit (c) 8-bit data length, msb first, even parity, 1 stop bit, transfer data: 55h, txdan inversion 1 data frame start bit d7 d6 d5 d4 d3 d2 d1 d0 parity bit stop bit (d) 7-bit data length, lsb first, odd pa rity, 2 stop bits, transfer data: 36h 1 data frame start bit d0 d1 d2 d3 d4 d5 d6 parity bit stop bit stop bit (e) 8-bit data length, lsb first, no pa rity, 1 stop bit, transfer data: 87h 1 data frame start bit d0 d1 d2 d3 d4 d5 d6 d7 stop bit
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 535 15.6.2 sbf transmission/reception format the v850es/sj2 and v850es/sj2-h have an sbf (sync break field) transmissi on/reception control function to enable use of the lin function. remark lin stands for local interconnect network and is a low-speed (1 to 20 kbps) serial communication protocol intended to aid the cost reduction of an automotive network. lin communication is single-master communicat ion, and up to 15 slaves can be connected to one master. the lin slaves are used to contro l the switches, actuators, and sensor s, and these are connected to the lin master via the lin network. normally, the lin master is connected to a network such as can (controller area network). in addition, the lin bus uses a single-wire method and is connected to the nodes via a transceiver that complies with iso9141. in the lin protocol, the master transmits a frame wit h baud rate information and the slave receives it and corrects the baud rate error. therefore, communicat ion is possible when the baud rate error in the slave is 15% or less. figures 15-6 and 15-7 outline the transmissi on and reception manipulations of lin. figure 15-6. lin transmi ssion manipulation outline lin bus wake-up signal frame sync break field sync field identifier field data field data field check sum field intuant interrupt txdan (output) note 3 8 bits note 1 note 2 13 bits sbf transmission note 4 55h transmission data transmission data transmission data transmission data transmission notes 1. the interval between each field is controlled by software. 2. sbf output is performed by har dware. the output width is the bit length set by the uanopt0.uansbl2 to uanopt0.uansbl0 bits. if even finer output width adjustments are required, such adjustments can be performed us ing the uanctl2.uanbrs7 to uanctl2.uanbrs0 bits. 3. 80h transfer in the 8-bit mode is substituted for the wakeup signal frame. 4. a transmission enable interrupt request signal (int uant) is output at the st art of each transmission. the intuant signal is also output at the start of each sbf transmission.
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 536 figure 15-7. lin recepti on manipulation outline reception interrupt (intuanr) edge detection capture timer disable disable enable rxdan (input) enable note 2 13 bits sbf reception note 3 note 4 note 1 sf reception id reception data transmission data transmission note 5 data transmission lin bus wake-up signal frame sync break field sync field identifier field data field data field check sum field notes 1. the wakeup signal is sent by the pin edge detec tor, uartan is enabled, and the sbf reception mode is set. 2. the receive operation is performed until detection of the stop bit. upon detection of sbf reception of 11 or more bits, normal sbf reception end is judged, and an interrupt signal is output. upon detection of sbf reception of less than 11 bits, an sbf reception error is judged, no interrupt signal is output, and the mode returns to the sbf reception mode. 3. if sbf reception ends normally, an interrupt request signal is output. the timer is enabled by an sbf reception completion interrupt. moreover, error detection for the uanstr.uanove, uanstr.uanpe, and uanstr.uanfe bits is suppressed and uart communication error detection processing and uartan receive shift register and data transfer of the uanrx register are not performed. the uartan receive shift register holds the initial value, ffh. 4. the rxdan pin is connected to ti (capture input) of the timer, the tran sfer rate is calculated, and the baud rate error is calculated. the value of the uanctl2 register obtained by correcting the baud rate error after dropping uarta enable is set again, causing the status to become the reception status. 5. check-sum field distinctions are made by softwar e. uartan is initialized following csf reception, and the processing for setting the sbf reception mode again is performed by software.
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 537 15.6.3 sbf transmission when the uanctl0.uanpwr bit = uanctl0.uantxe bit = 1, the transmission enabled status is entered, and sbf transmission is started by setting (to 1) the sbf transmission trigger (uanopt0.uanstt bit). thereafter, a low level the width of bits 13 to 20 specif ied by the uanopt0.uansls2 to uanopt0.uansls0 bits is output. a transmission enable interrupt request signal (intuant) is generated upon sbf transmission start. following the end of sbf transmission, the uanstt bit is aut omatically cleared. thereafter, the uart transmission mode is restored. transmission is suspended until the data to be transmitted next is written to the uantx register, or until the sbf transmission trigger (uanstt bit) is set. figure 15-8. sbf transmission intuant interrupt txdan 12345678910111213 stop bit setting of uanstt bit
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 538 15.6.4 sbf reception the reception enabled status is achieved by setting the uanctl0.uanpwr bit to 1 and then setting the uanctl0.uanrxe bit to 1. the sbf reception wait status is set by setting the sbf reception trigger (uanopt0.uanstr bit) to 1. in the sbf reception wait status, similarly to the uart re ception wait status, the rxda n pin is monitored and start bit detection is performed. following detection of the start bit, rec eption is started and the in ternal counter counts up according to the set baud rate. when a stop bit is received, if the sbf width is 11 or more bits, normal processing is judged and a reception completion interrupt request signal (intuanr) is output. th e uanopt0.uansrf bit is aut omatically cleared and sbf reception ends. error detection for the uanstr.uanove, uanstr.uanpe, and uanstr.uanfe bits is suppressed and uart communication error detection processing is not performed. moreover, data transfer of the uartan reception shift register and uanrx regist er is not performed and ffh, the initial valu e, is held. if the sbf width is 10 or fewer bits, reception is terminated as error processi ng without outputting an interrupt, and the sbf reception mode is returned to. the uansrf bit is not cleared at this time. caution the lin function does not assume that sbf is transmitted while da ta is being received. consequently, if sbf is transm itted while data is being r eceived, a framing error occurs (uanstr.uanfe bit = 1).
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 539 figure 15-9. sbf reception (a) normal sbf reception (detection of stop bit in more than 10.5 bits) uansrf rxdan 123456 11.5 7 8 9 10 11 intuanr interrupt (b) sbf reception error (detection of stop bit in 10.5 or fewer bits) uansrf rxdan 123456 10.5 78910 intuanr interrupt
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 540 15.6.5 uart transmission a high level is output to the txdan pin by setting the uanctl0.uanpwr bit to 1. next, the transmission enabled status is set by setting t he uanctl0.uantxe bit to 1, and transmission is started by writing transmit data to the uantx register. the st art bit, parity bit, and stop bit are automatically added. since the cts (transmit enable signal) input pin is not pr ovided in uartan, use a port to check that reception is enabled at the transmit destination. the data in the uantx register is tr ansferred to the uartan transmit shift register upon the start of the transmit operation. a transmission enable interrupt request signal (intuant) is generated upon completion of transmission of the data of the uantx register to the uartan transmit shift register , and thereafter the contents of the uartan transmit shift register are output to the txdan pin. write of the next transmit data to t he uantx register is enabled after the intuant signal is generated. figure 15-10. uart transmission start bit d0 d1 d2 d3 d4 d5 d6 d7 parity bit stop bit intuant txdan remark lsb first
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 541 15.6.6 continuous transmission procedure uartan can write the next transmit data to the uantx regist er when the uartan transmit shift register starts the shift operation. the transmit timing of the uartan transmi t shift register can be judged from the transmission enable interrupt request signal (intuant). an efficient communication rate is realized by writing t he data to be transmitted next to the uantx register during transfer. caution when initializing transmis sions during the execution of contin uous transmissions, make sure that the uanstr.uantsf bit is 0, then perform the in itialization. transmit data that is initialized when the uantsf bit is 1 cannot be guaranteed. figure 15-11. continuous transmission processing flow start register settings uantx write yes yes no no occurrence of transmission interrupt? required number of writes performed? end
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 542 figure 15-12. continuous transmission operation timing (a) transmission start start data (1) data (1) txdan uantx transmission shift register intuant uantsf data (2) data (2) data (1) data (3) parity stop start data (2) parity stop start (b) transmission end start data (n ? 1) data (n ? 1) data (n ? 1) data (n) ff data (n) txdan uantx transmission shift register intuant uantsf uanpwr or uantxe bit parity stop stop start data (n) parity parity stop
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 543 15.6.7 uart reception the reception wait status is set by setting the uanctl0.uanpwr bit to 1 and then setting the uanctl0.uanrxe bit to 1. in the reception wait status, the rxdan pin is monitored and start bit detection is performed. start bit detection is performed using a two-step detection routine. first the rising edge of the rxdan pin is detected and sampling is started at the falling edge. the start bit is recognized if the rxdan pin is low level at the start bit sampling point. after a start bit has been recognized, the receive operation starts, and serial data is saved to the uart an receive shift register according to the set baud rate. when the reception completion interrupt request signal (i ntuanr) is output upon receptio n of the stop bit, the data of the uartan receive shift register is written to t he uanrx register. however, if an overrun error occurs (uanstr.uanove bit = 1), the receive data at this time is not written to the uanrx register and is discarded. even if a parity error (uanstr.uanpe bit = 1) or a framin g error (uanstr.uanfe bit = 1) occurs during reception, reception continues until the recepti on position of the first stop bit, and in tuanr is output following reception completion. figure 15-13. uart reception start bit d0 d1 d2 d3 d4 d5 d6 d7 parity bit stop bit intuanr rxdan uanrx remark v : sampling point of start bit cautions 1. be sure to read the uanrx register even when a reception error occurs. if the uanrx register is not read, an overrun error occurs during r eception of the next data, and reception errors continue occurring indefinitely. 2. the operation during recepti on is performed assuming that th ere is only one stop bit. a second stop bit is ignored. 3. when reception is completed, read the ua nrx register after the reception completion interrupt request signal (intuanr) has been ge nerated, and clear the uanpwr or uanrxe bit to 0. if the uanpwr or uanrxe bit is cleared to 0 before the intuan r signal is generated, the read value of the uanrx re gister cannot be guaranteed. 4. if receive completion processing (intuanr signal generation) of uartan and the uanpwr bit = 0 or uanrxe bit = 0 conflict, the intuan r signal may be generated in spite of these being no data stored in the uanrx register. to complete reception without waiting intuanr signal generation, be sure to clear (0) the in terrupt request flag (uanrif) of the uanric register, after setting (1) the interrupt mask flag (uanrmk) of the interrupt control register (uanric) and then set (1) the uanpwr bit = 0 or uanrxe bit = 0.
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 544 15.6.8 reception errors errors during a receive operation are of three types: parity errors, framing errors, and overrun errors. data reception result error flags are set in the uanstr r egister and a reception completion interrupt request signal (intuanr) is output when an error occurs. it is possible to ascertain which error occurred during reception by reading the contents of the uanstr register. clear the reception error flag by writing 0 to it after reading it. ? receive data read flow start no intuanr signal generated? error occurs? end yes no yes error processing read uanrx register read uanstr register caution when an intuanr signal is generated, the ua nstr register must be read to check for errors. ? reception error causes error flag reception error cause uanpe parity error received parity bit does not match the setting uanfe framing error stop bit not detected uanove overrun error reception of next data completed before data was read from uanrx register
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 545 when reception errors occur, perform the followin g procedures depending upon the kind of error. ? parity error if false data is received due to problems such as noi se in the reception line, discard the received data and retransmit. ? framing error a baud rate error may have occurred between the reception side and transmission side or the start bit may have been erroneously detected. since this is a fatal error for the communication format, check the operation stop in the transmission side, perform initialization processing each other, and then start the communication again. ? overrun error since the next reception is completed before reading receiv e data, 1 frame of data is discarded. if this data was needed, do a retransmission. caution if a receive error interrupt occurs during c ontinuous reception, read the contents of the uanstr register must be read before the next reception is completed, then perform error processing.
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 546 15.6.9 parity types and operations caution when using the lin function, fix the uanps1 a nd uanps0 bits of the uanctl0 register to 00. the parity bit is used to detect bit errors in the communic ation data. normally the same parity bit is used on the transmission side and the reception side. in the case of even parity and odd parity, it is possible to detect odd-count bit errors. in the case of 0 parity and no parity, errors cannot be detected. (a) even parity (i) during transmission the number of bits whose value is ?1? among the transmi t data, including the parity bit, is controlled so as to be an even number. the parity bit values are as follows. ? odd number of bits whose value is ?1? among transmit data: 1 ? even number of bits whose value is ?1? among transmit data: 0 (ii) during reception the number of bits whose value is ?1? among the rec eption data, including the parit y bit, is counted, and if it is an odd number, a parity error is output. (b) odd parity (i) during transmission opposite to even parity, the number of bits whose value is ?1? among t he transmit data, including the parity bit, is controlled so that it is an odd number . the parity bit values are as follows. ? odd number of bits whose value is ?1? among transmit data: 0 ? even number of bits whose value is ?1? among transmit data: 1 (ii) during reception the number of bits whose value is ?1? among the receiv e data, including the parity bit, is counted, and if it is an even number, a parity error is output. (c) 0 parity during transmission, the parity bit is always made 0, regardless of the transmit data. during reception, parity bit check is not performed. therefore, no parity e rror occurs, regardless of whether the parity bit is 0 or 1. (d) no parity no parity bit is added to the transmit data. reception is performed assuming that ther e is no parity bit. no parity error occurs since there is no parity bit.
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 547 15.6.10 receive data noise filter this filter samples the rxdan pin using the base clock (f uclk ) of the prescaler output. when the same sampling value is read twice, the match det ector output changes and the rxdan signal is sampled as the input data. therefore, data not exceeding 2 clock width is judged to be noise and is not delivered to the internal circuit (see figure 15-15 ). see 15.7 (1) (a) base clock regarding the base clock. moreover, since the circuit is as shown in figure 15-14, the processing that goes on wit hin the receive operation is delayed by 3 clocks in relation to the external signal status. figure 15-14. noise filter circuit match detector in base clock (f uclk ) rxdan qin ld_en q internal signal c internal signal b in q internal signal a figure 15-15. timing of rxdan signal judged as noise internal signal b base clock (f uclk ) rxdan (input) internal signal c mismatch (judged as noise) internal signal a mismatch (judged as noise) match match
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 548 15.7 dedicated baud rate generator the dedicated baud rate generator consists of a source clock selector block and an 8-bit programmable counter, and generates a serial clock during transmission and reception with uartan. regarding the serial clock, a dedicated baud rate generator output can be selected for each channel. there is an 8-bit counter for transmission and another one for reception. (1) baud rate generator configuration figure 15-16. configurati on of baud rate generator base clock (f uclk ) selector uanpwr bit 8-bit counter match detector baud rate uanctl2.uanbrs7 to uanctl2.uanbrs0 bits 1/2 uanpwr, uantxe bits (or uanrxe bit) uanctl1.uancks3 to uanctl1.uancks0 bits f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 f xx /128 f xx /256 f xx /512 f xx /1024 ascka0 pin note output clock note only uarta0 is valid; setting uart a1 to uarta3 is prohibited. caution uartan cannot be used if the cpu clock (f cpu ) is slower than f uclk . remarks 1. n = 0 to 3 2. f xx : main clock frequency f uclk : base clock frequency (a) base clock when the uanctl0.uanpwr bit is 1, the cl ock selected by the uanctl1.uancks3 to uanctl1.uancks0 bits is supplied to the 8-bit counter. this clock is called the base clock (f uclk ). the base clock f uclk is fixed to the low level when the uanpwr bit is 0. (b) serial clock generation a serial clock can be generated by setting the uanctl1 register and the uanctl2 register (n = 0 to 3). the base clock (f uclk ) is selected by uanctl1.uancks3 to uanctl1.uancks0 bits. the frequency division value for the 8-bit count er can be set using the uanctl2.uanbrs7 to uanctl2.uanbrs0 bits.
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 549 (2) uartan control register 1 (uanctl1) the uanctl1 register is an 8-bit register that selects the uartan base clock. this register can be read or written in 8-bit units. reset sets this register to 00h. caution clear the uanctl0.uanpwr bit to 0 before rewriting the uanctl1 register. 0 uanctl1 (n = 0 to 3) 0 0 0 uancks3 uancks2 uancks1 uancks0 654321 after reset: 00h r/w address: ua0ctl1 fffffa01h, ua1ctl1 fffffa11h, ua2ctl1 fffffa21h, ua3ctl1 fffffa31h 7 0 f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 f xx /128 f xx /256 f xx /512 f xx /1,024 external clock note (ascka0 pin) setting prohibited uancks2 0 0 0 0 1 1 1 1 0 0 0 0 uancks3 0 0 0 0 0 0 0 0 1 1 1 1 base clock (f uclk ) selection uancks1 0 0 1 1 0 0 1 1 0 0 1 1 uancks0 0 1 0 1 0 1 0 1 0 1 0 1 other than above note only uarta0 is valid; setting uart a1 to uarta3 is prohibited. remark f xx : main clock frequency
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 550 (3) uartan control register 2 (uanctl2) the uanctl2 register is an 8-bit register that selects the baud rate (serial transfer speed) clock of uartan. this register can be read or written in 8-bit units. reset sets this register to ffh. caution clear the uanctl0.uanpwr bit to 0 or clear the uantxe and uanrxe bits to 00 before rewriting the uanctl2 register. uanbrs7 uanctl2 (n = 0 to 3) uanbrs6 uanbrs5 uanbrs4 uanbrs3 uanbrs2 uanbrs1 uanbrs0 654321 after reset ffh r/w address: ua0ctl2 fffffa02h, ua1ctl2 fffffa12h, ua2ctl2 fffffa22h, ua3ctl2 fffffa32h 7 0 uan brs7 0 0 0 0 : 1 1 1 1 uan brs6 0 0 0 0 : 1 1 1 1 uan brs5 0 0 0 0 : 1 1 1 1 uan brs4 0 0 0 0 : 1 1 1 1 uan brs3 0 0 0 0 : 1 1 1 1 uan brs2 0 1 1 1 : 1 1 1 1 uan brs1 0 0 1 : 0 0 1 1 uan brs0 0 1 0 : 0 1 0 1 default (k) 4 5 6 : 252 253 254 255 serial clock f uclk /4 f uclk /5 f uclk /6 : f uclk /252 f uclk /253 f uclk /254 f uclk /255 setting prohibited remark f uclk : frequency of base clock frequency selected by the uanctl1.uancks3 to uanctl1.uancks0 bits
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 551 (4) baud rate the baud rate is obtained by the following equation. baud rate = [bps] when using the internal clock, the equation will be as follows (when using the ascka0 pin as clock at uarta0, calculate using the above equation). baud rate = [bps] remark f uclk = frequency of base clock selected by the uanctl1.uancks3 to uanctl1.uancks0 bits f xx : main clock frequency m = value set using the uanctl1.uancks3 to uanctl1.uancks0 bits (m = 0 to 10) k = value set using the uanctl2.uanbrs7 to uanctl2.uanbrs0 bits (k = 4 to 255) the baud rate error is obtained by the following equation. error (%) = ? 1 100 [%] = ? 1 100 [%] when using the internal clock, the equation will be as follows (when using the ascka0 pin as clock at uarta0, calculate the baud rate error using the above equation). error (%) = ? 1 100 [%] cautions 1. the baud rate erro r during transmission must be wit hin the error tolerance on the receiving side. 2. the baud rate error during reception must sat isfy the range indicated in (5) allowable baud rate range dur ing reception. f uclk 2 k actual baud rate (baud rate with error) target baud rate (correct baud rate) f xx 2 m+1 k f uclk 2 k target baud rate f xx 2 m+1 k target baud rate
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 552 to set the baud rate, perform the following calculatio n and set the uanctl1 and uanctl2 registers (when using internal clock). <1> set k = f xx /(2 target baud rate). set m = 0. <2> set k = k/2 and m = m + 1 where k 256. <3> repeat <2> until k < 256. <4> roundup the first decimal place of k. if k = 256 by the roundup, perform <2> again (k will become 128). <5> set m to the uanctl1 register and k to the uanctl2 register. example: when f xx = 20 mhz and target baud rate = 153,600 bps <1> k = 20,000,000/(2 153,600) = 65.10?, m = 0 <2>, <3> k = 65.10? < 256, m = 0 <4> set value of uanctl2 register: k = 65 = 41h, set value of uanctl1 register: m = 0 actual baud rate = 20,000,000/(2 65) = 153,846 [bps] baud rate error = {20,000,000/(2 65 153,600) ? 1} 100 = 0.160 [%] the representative examples of baud rate settings are shown below. table 15-3. baud rate ge nerator setting data (1/2) f xx = 32 mhz note f xx = 20 mhz f xx = 18.874 mhz baud rate (bps) uanctl1 uanctl2 err (%) uanctl1 uanctl2 err (%) uanctl1 uanctl2 err (%) 300 08h d0h 0.16 08h 82h 0.16 07h f6h ? 0.10 600 07h d0h 0.16 07h 82h 0.16 06h f6h ? 0.10 1,200 06h d0h 0.16 06h 82h 0.16 05h f6h ? 0.10 2,400 05h d0h 0.16 05h 82h 0.16 04h f6h ? 0.10 4,800 04h d0h 0.16 04h 82h 0.16 03h f6h ? 0.10 9,600 03h d0h 0.16 03h 82h 0.16 02h f6h ? 0.10 19,200 02h d0h 0.16 02h 82h 0.16 01h f6h ? 0.10 31,250 02h 80h 0.00 01h a0h 0.00 01h 97h ? 0.01 38,400 01h d0h 0.16 01h 82h 0.16 00h f6h ? 0.10 76,800 00h d0h 0.16 00h 82h 0.16 00h 7bh ? 0.10 153,600 00h 68h 0.16 00h 41h 0.16 00h 3dh 0.72 312,500 00h 33h 0.39 00h 20h 0.00 00h 1eh 0.66 note v850es/sj2-h only remark f xx : main clock frequency err: baud rate error (%)
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 553 table 15-3. baud rate ge nerator setting data (2/2) f xx = 16 mhz f xx = 10 mhz baud rate (bps) uanctl1 uanctl2 err (%) uanctl1 uanctl2 err (%) 300 07h d0h 0.16 07h 82h 0.16 600 06h d0h 0.16 06h 82h 0.16 1,200 05h d0h 0.16 05h 82h 0.16 2,400 04h d0h 0.16 04h 82h 0.16 4,800 03h d0h 0.16 03h 82h 0.16 9,600 02h d0h 0.16 02h 82h 0.16 19,200 01h d0h 0.16 01h 82h 0.16 31,250 01h 80h 0 00h a0h 0.00 38,400 00h d0h 0.16 00h 82h 0.16 76,800 00h 68h 0.16 00h 41h 0.16 153,600 00h 34h 0.16 00h 21h ? 1.36 312,500 00h 1ah ? 1.54 00h 10h 0.00 remark f xx : main clock frequency err: baud rate error (%) (5) allowable baud rate range during reception the baud rate error range at the destination that is allowable during reception is shown below. caution the baud rate error during reception must be set within the allowable error range using the following equation. figure 15-17. allowable baud rate range during reception fl 1 data frame (11 fl) flmin flmax uartan transfer rate start bit bit 0 bit 1 bit 7 parity bit minimum allowable transfer rate maximum allowable transfer rate stop bit start bit bit 0 bit 1 bit 7 parity bit latch timing stop bit start bit bit 0 bit 1 bit 7 parity bit stop bit remark n = 0 to 3
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 554 as shown in figure 15-17, the receive data latch timing is determined by the counter set using the uanctl2 register following start bit detection. the transmit data can be normally received if up to the last data (stop bit) can be received in time for this latch timing. when this is applied to 11-bit reception, t he following is the theoretical result. fl = (brate) ? 1 brate: uartan baud rate (n = 0 to 3) k: setting value of uanctl2.uanbrs7 to uanctl2.uanbrs0 bits (n = 0 to 3) fl: 1-bit data length latch timing margin: 2 clocks minimum allowable transfer rate: flmin = 11 fl ? fl = fl therefore, the maximum baud rate that can be re ceived by the destination is as follows. brmax = (flmin/11) ? 1 = brate similarly, obtaining the following maximum allowable transfer rate yields the following. flmax = 11 fl ? fl = fl flmax = fl 11 therefore, the minimum baud rate that can be received by the destination is as follows. brmin = (flmax/11) ? 1 = brate obtaining the allowable baud rate error for uartan and the destination from the above-described equations for obtaining the minimum and maximum baud rate values yields the following. k ? 2 2k 21k + 2 2k 10 11 k + 2 2 k 21k ? 2 2 k 21k ? 2 20 k 22k 21k + 2 20k 21k ? 2
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 555 table 15-4. maximum/minimum allowable baud rate error division ratio (k) maximum allowable baud rate error minimum allowable baud rate error 4 +2.32% ? 2.43% 8 +3.52% ? 3.61% 20 +4.26% ? 4.30% 50 +4.56% ? 4.58% 100 +4.66% ? 4.67% 255 +4.72% ? 4.72% remarks 1. the reception accuracy depends on the bi t count in 1 frame, the input clock frequency, and the division ratio (k). the higher the input clock frequency and the larger the division ratio (k), the higher the accuracy. 2. k: setting value of uanctl2.uanbrs7 to uanctl2.uanbrs0 bits (n = 0 to 3) (6) baud rate during c ontinuous transmission during continuous transmission, the transfer rate from the stop bit to the next start bit is usually 2 base clocks longer. however, timing initialization is performed via st art bit detection by the receiving side, so this has no influence on the transfer result. figure 15-18. transfer rate during continuous transfer start bit bit 0 bit 1 bit 7 parity bit stop bit fl 1 data frame fl fl fl fl fl fl flstp start bit of 2nd byte start bit bit 0 assuming 1 bit data length: fl; stop bit length: flstp; and base clock frequency: f uclk , we obtain the following equation. flstp = fl + 2/f uclk therefore, the transfer rate during continuous transmission is as follows. transfer rate = 11 fl + (2/f uclk )
chapter 15 asynchronous serial interface a (uarta) user?s manual u16603ej5v1ud 556 15.8 cautions (1) when the clock supply to uartan is stopped (for exam ple, in idle1, idle2, or stop mode), the operation stops with each register retaining the value it had i mmediately before the clock supply was stopped. the txdan pin output also holds and outputs the value it ha d immediately before the clock supply was stopped. however, the operation is not guaranteed after the clock su pply is resumed. therefore, after the clock supply is resumed, the circuits should be initialized by setting the uanctl0.uanpwr, uanctl0.uanrxen, and uanctl0.uantxen bits to 000. (2) the rxda1 and kr7 pins must not be us ed at the same time. to use the rx da1 pin, do not use the kr7 pin. to use the kr7 pin, do not use the rxda1 pin (it is recommended to set the pfc91 bit to 1 and clear pfce91 bit to 0). (3) in uartan, the interrupt caused by a communication error does not occur. when performing the transfer of transmit data and receive data using dma transfer, error processing cannot be performed even if errors (parity, overrun, framing) occur during transfer. either read the uanstr register after dma transfer has been completed to make sure that there are no errors, or read the uanstr register during communication to check for errors. (4) start up the uartan in the following sequence. <1> set the uanctl0.uanpwr bit to 1. <2> set the ports. <3> set the uanctl0.uantxe bit to 1, uanctl0.uanrxe bit to 1. (5) stop the uartan in the following sequence. <1> set the uanctl0.uantxe bit to 0, uanctl0.uanrxe bit to 0. <2> set the ports and set the uanctl0.uanpwr bit to 0 (it is not a problem if port setting is not changed). (6) in transmit mode (uanctl0.uanpwr bit = 1 and uanctl0.uantxe bit = 1), do not overwrite the same value to the uantx register by software because transmission star ts by writing to this register. to transmit the same value continuously, overwrite the same value. (7) in continuous transmission, the communication rate fr om the stop bit to the next start bit is extended 2 base clocks more than usual. however, the reception side init ializes the timing by detecting the start bit, so the reception result is not affected.
user?s manual u16603ej5v1ud 557 chapter 16 3-wire variable-length serial i/o (csib) 16.1 mode switching of csib and other serial interfaces 16.1.1 csib4 and uarta0 mode switching in the v850es/sj2 and v850es/sj2-h, cs ib4 and uarta0 are alternate functions of the same pin and therefore cannot be used simultaneously. set csib4 in advance, using the pmc3 and pfc3 registers, before use. caution the transmit/receive operation of csib4 and uarta0 is not guaranteed if these functions are switched during transmission or reception. be sure to disable the one that is not used. figure 16-1. csib4 and uarta0 mode switch settings pmc3 after reset: 0000h r/w address: fffff446h, fffff447h pmc37 pmc36 pmc35 pmc34 pmc33 pmc32 pmc31 pmc30 0 0 0 0 0 0 pmc39 pmc38 8 9 10 11 12 13 14 15 pfc3 after reset: 0000h r/w address: fffff466h, fffff467h 0 0 0 0 0 0 pfc39 pfc38 pfc37 pfc36 pfc35 pfc34 pfc33 pfc32 pfc31 pfc30 8 9 10 11 12 13 14 15 pfce3l after reset: 00h r/w address: fffff706h 0 0 0 pfce34 pfce33 pfce32 0 0 port i/o mode ascka0 mode sckb4 mode port i/o mode uarta0 mode csib4 mode pmc32 0 1 1 pmc3n 0 1 1 operation mode operation mode pfce32 0 0 pfc32 0 1 pfc3n 0 1 remarks 1. n = 0, 1 2. = don?t care
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 558 16.1.2 csib0 and i 2 c01 mode switching in the i 2 c bus versions (y products) of the v850es/sj2 and v850es/sj2-h, csib0 and i 2 c01 are alternate functions of the same pin and therefor e cannot be used simultaneously. set cs ib0 in advance, using the pmc4 and pfc4 registers, before use. caution the transmit/receive operation of csib0 and i 2 c01 is not guaranteed if these functions are switched during transmission or reception. be su re to disable the one that is not used. figure 16-2. csib0 and i 2 c01 mode switch settings port i/o mode csib0 mode i 2 c01 mode pmc4n 0 1 1 operation mode pfc4n 0 1 0 pmc4 0 0 0 0 pmc42 pmc41 pmc40 after reset: 00h r/w address: fffff448h pfc4 after reset: 00h r/w address: fffff468h 0 0 0 0 0 0 pfc41 pfc40 remarks 1. n = 0, 1 2. = don?t care
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 559 16.2 features { transfer rate: 8 mbps max. (v850es/sj2: f xx = 20 mhz, v850es/sj2-h: f xx = 32 mhz, using internal clock) { master mode and slave mode selectable { 8-bit to 16-bit transfer, 3-wire serial interface { interrupt request signals (intcbnt, intcbnr) { serial clock and data phase switchable { transfer data length selectable in 1-bit units between 8 and 16 bits { transfer data msb-first/lsb-first switchable { 3-wire transfer sobn: serial data output sibn: serial data input sckbn: serial clock output transmission mode, reception mode, and transmission/reception mode specifiable remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 560 16.3 configuration the following shows the block diagram of csibn. figure 16-3. block diagram of csibn internal bus cbnctl2 cbnctl0 cbnstr controller intcbnr sobn intcbnt cbntx so latch phase control shift register cbnrx cbnctl1 phase control sibn f brgm f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 sckbn selector f cclk remark f cclk : communication clock f xx : main clock frequency f brgm : brgm count clock n = 0 to 5 m = 1 (n = 0, 1) m = 2 (n = 2, 3) m = 3 (n = 4, 5) csibn includes the following hardware. table 16-1. configuration of csibn item configuration registers csibn receive data register (cbnrx) csibn transmit data register (cbntx) control registers csibn control register 0 (cbnctl0) csibn control register 1 (cbnctl1) csibn control register 2 (cbnctl2) csibn status register (cbnstr)
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 561 (1) csibn receive data register (cbnrx) the cbnrx register is a 16-bit buffer register that holds receive data. this register is read-only, in 16-bit units. the receive operation is started by reading the cbnrx register in the reception enabled status. if the transfer data length is 8 bits, the lower 8 bits of th is register are read-only in 8-bit units as the cbnrxl register. reset sets this register to 0000h. in addition to reset input, the cbnrx register can be in itialized by clearing (to 0) the cbnpwr bit of the cbnctl0 register. after reset: 0000h r address: cb0rx fffffd04h, cb1rx fffffd14h, cb2rx fffffd24h, cb3rx fffffd34h, cb4rx fffffd44h, cb5rx fffffd54h cbnrx (n = 0 to 5) (2) csibn transmit data register (cbntx) the cbntx register is a 16-bit buffer regist er used to write the csibn transfer data. this register can be read or written in 16-bit units. the transmit operation is started by writing data to t he cbntx register in the transmission enabled status. if the transfer data length is 8 bits, the lower 8 bits of th is register are read-only in 8-bit units as the cbntxl register. reset sets this register to 0000h. after reset 0000h r/w address: cb0tx fffffd06h, cb1tx fffffd16h, cb2tx fffffd26h, cb3tx fffffd36h, cb4tx fffffd46h, cb5tx fffffd56h cbntx (n = 0 to 5) remark the communication start conditions are shown below. transmission mode (cbntxe bit = 1, cbnrxe bit = 0): write to cbntx register transmission/reception mode (cbntxe bit = 1, cb nrxe bit = 1): write to cbntx register reception mode (cbntxe bit = 0, cbnrxe bit = 1): read from cbnrx register
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 562 16.4 registers the following registers are used to control csibn. ? csibn control register 0 (cbnctl0) ? csibn control register 1 (cbnctl1) ? csibn control register 2 (cbnctl2) ? csibn status register (cbnstr) (1) csibn control register 0 (cbnctl0) cbnctl0 is a register that controls the csibn serial transfer operation. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 01h. (1/3) cbnpwr disable csibn operation and reset the cbnstr register enable csibn operation cbnpwr 0 1 specification of csibn operation disable/enable cbnctl0 (n = 0 to 5) cbntxe note cbnrxe note cbndir note 00 cbntms note cbnsce after reset: 01h r/w address: cb0ctl0 fffffd00h, cb1ctl0 fffffd10h, cb2ctl0 fffffd20h, cb3ctl0 fffffd30h, cb4ctl0 fffffd40h, cb5ctl0 fffffd50h ? the cbnpwr bit controls the csibn operation and resets the internal circuit. disable transmit operation enable transmit operation cbntxe note 0 1 specification of transmit operation disable/enable ? the sobn output is low level when the cbntxe bit is 0. ? when the cbnrxe bit is cleared to 0, no reception completion interrupt is output even when the prescribed data is transferred in order to disable the receive operation, and the receive data (cbnrx register) is not updated. disable receive operation enable receive operation cbnrxe note 0 1 specification of receive operation disable/enable < > < > < > < > < > note these bits can only be rewritten when the cbnpwr bit = 0. however, cbnpwr bit = 1 can also be set at the same time as rewriting these bits. cautions 1. to forcibly suspend transmission/ reception, clear the cbnpw r bit instead of the cbntxe and cbnrxe bits to 0. at this time, the clock output is stopped. 2. be sure to set bits 3 and 2 to ?0?.
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 563 (2/3) single transfer mode continuous transfer mode cbntms note 0 1 transfer mode specification [in single transfer mode] the reception completion interrupt (intcbnr) occurs when communication is complete. even if transmission is enabled (cbntxe bit = 1), the transmission enable interrupt (intcbnt) does not occur. if the next transmit data is written during communication (cbnstr.cbntsf bit = 1), it is ignored and the next communication is not started. also, if receive-only communication is set (cbntxe bit = 0, cbnrxe bit = 1), the next communication is not started even if the receive data is read during communication (cbnstr. cbntsf bit = 1). [in continuous transfer mode] the continuous transmission is enabled by writing the next transmit data during communication (cbnstr.cbntsf bit = 1). writing the next transmission data is enabled after a transmission enable interrupt (intcbnt) occurrence. if receive-only communication is set (cbntxe bit = 0, cbnrxe bit = 1) in the continuous transfer mode, the next reception is started continuously after a reception completion interrupt (intcbnr) regardless of the read operation of the cbnrx register. therefore, read immediately the receive data from the cbnrx register. if this read operation is delayed, an overrun error (cbnove bit = 1) occurs. cbndir note 0 1 specification of transfer direction mode (msb/lsb) msb-first transfer lsb-first transfer note these bits can only be rewritten when the cbnpwr bit = 0. however, the cbnpwr can be set to 1 at the same time as these bits are rewritten.
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 564 (3/3) communication start trigger invalid communication start trigger valid cbnsce 0 1 specification of start transfer disable/enable ? in master mode this bit enables or disables the communication start trigger. (a) in single transmission or transmission/reception mode, or continuous transmission or continuous transmission/reception mode the setting of the cbnsce bit has no influence on communication operation. (b) in single reception mode clear the cbnsce bit to 0 before reading the last receive data because reception is started by reading the receive data (cbnrx register) to disable the reception startup note 1 . (c) in continuous reception mode clear the cbnsce bit to 0 one communication clock before reception of the last data is completed to disable the reception startup after the last data is received note 2 . ? in slave mode this bit enables or disables the communication start trigger. set the cbnsce bit to 1. note 3 notes 1. if the cbnsce bit is read while it is 1, t he next communication operation is started. 2. the cbnsce bit is not cleared to 0 one communica tion clock before the completion of the last data reception, the next communication operation is automatically started. to start the communication operation again a fter the last data has been read, set the cbnsce bit to ?1? and dummy-read the cbnrx register. 3. to start the reception, dummy reading is necessary.
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 565 (a) how to use cbnsce bit (i) in single reception mode <1> when the reception of the la st data is completed with intcbnr interrupt servicing, clear the cbnsce bit to 0, and then read the cbnrx register. <2> when the reception is disabled after the rec eption of the last data has been completed, check that the cbnstr.cbntsf bit is 0, and then cl ear the cbnpwr and cbnrxe bits to 0. to continue reception, set the cbnsce bit to 1 and start the next receive operation by performing a dummy read of the cbnrx register. (ii) in continu ous reception mode <1> clear the cbnsce bit to 0 during reception of the last data with intcbnr interrupt servicing by the reception before the last recept ion, and then read the cbnrx register. <2> after receiving the intcbnr signal of the la st reception, read the la st data from the cbnrx register. <3> when the reception is disabled after the rec eption of the last data has been completed, check that the cbnstr.cbntsf bit is 0, and then cl ear the cbnpwr and cbnrxe bits to 0. to continue reception, set the cbnsce bit to 1 and start the next receive operation by performing a dummy read of the cbnrx register. caution in continuous recepti on mode, the serial clock is not stopped until the reception executed when the cbnsce bit is cleared to 0 is completed after the reception is started by a dummy read.
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 566 (2) csibn control register 1 (cbnctl1) cbnctl1 is an 8-bit register that controls the csibn serial transfer operation. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. caution the cbnctl1 register can be rewritte n only when the cbnc tl0.cbnpwr bit = 0. 0 cbnckp 0 0 1 1 specification of data transmission/ reception timing in relation to sckbn cbnctl1 (n = 0 to 5) 0 cbndap 0 1 0 1 0 cbnckp cbndap cbncks2 cbncks1 cbncks0 after reset 00h r/w address: cb0ctl1 fffffd01h, cb1ctl1 fffffd11h, cb2ctl1 fffffd21h, cb3ctl1 fffffd31h, cb4ctl1 fffffd41h, cb5ctl1 fffffd51h cbncks2 0 0 0 0 1 1 1 1 cbncks1 0 0 1 1 0 0 1 1 cbncks0 0 1 0 1 0 1 0 1 communication clock (f cclk ) note f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 f brgm external clock (sckbn) master mode master mode master mode master mode master mode master mode master mode slave mode mode d7 d6 d5 d4 d3 d2 d1 d0 sckbn (i/o) sibn capture sobn (output) d7 d6 d5 d4 d3 d2 d1 d0 sckbn (i/o) sibn capture sobn (output) d7 d6 d5 d4 d3 d2 d1 d0 sckbn (i/o) sibn capture (output) d7 d6 d5 d4 d3 d2 d1 d0 sckbn (i/o) sibn capture (output) communication type 1 communication type 2 communication type 3 communication type 4 note set the communication clock (f cclk ) to 8 mhz or lower. remark when n = 0, 1, m = 1 when n = 2, 3, m = 2 when n = 4, 5, m = 3 for details of f brgm , see 16.8 baud rate generator .
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 567 (3) csibn control register 2 (cbnctl2) cbnctl2 is an 8-bit register that controls the number of csibn serial transfer bits. this register can be read or written in 8-bit units. reset sets this register to 00h. caution the cbnctl2 register can be rewritten only when the cbnctl0.cbnpwr bit = 0 or when both the cbntxe and cbnrxe bits = 0. after reset: 00h r/w address: cb0ctl2 fffffd02h, cb1ctl2 fffffd12h, cb2ctl2 fffffd22h, cb3ctl2 fffffd32h, cb4ctl2 fffffd42h, cb5ctl2 fffffd52h 0 cbnctl2 (n = 0 to 5) 0 0 0 cbncl3 cbncl2 cbncl1 cbncl0 8 bits 9 bits 10 bits 11 bits 12 bits 13 bits 14 bits 15 bits 16 bits cbncl3 0 0 0 0 0 0 0 0 1 cbncl2 0 0 0 0 1 1 1 1 cbncl1 0 0 1 1 0 0 1 1 cbncl0 0 1 0 1 0 1 0 1 serial register bit length remarks 1. if the number of transfer bits is other than 8 or 16, prepare and use dat a stuffed from the lsb of the cbntx and cbnrx registers. 2. : don?t care
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 568 (a) transfer data length change function the csibn transfer data length can be set in 1-bit units between 8 and 16 bits using the cbnctl2.cbncl3 to cbnctl2.cbncl0 bits. when the transfer bit length is set to a value othe r than 16 bits, set the data to the cbntx or cbnrx register starting from the lsb, regardless of whether t he transfer start bit is the msb or lsb. any data can be set for the higher bits that are not used, but the receive data becomes 0 following serial transfer. (i) transfer bit length = 10 bits, msb first 15 10 9 0 sobn sibn insertion of 0 (ii) transfer bit length = 12 bits, lsb first 0 sobn 11 12 15 sibn insertion of 0
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 569 (4) csibn status register (cbnstr) cbnstr is an 8-bit register t hat displays the csibn status. this register can be read or written in 8-bit or 1-bit units, but the cbntsf flag is read-only. reset sets this register to 00h. in addition to reset input, the cbnstr register can be initialized by clearing (0) the cbnctl0.cbnpwr bit. cbntsf communication stopped communicating cbntsf 0 1 communication status flag cbnstr (n = 0 to 5) 00 0 00 0 cbnove after reset 00h r/w address: cb0str fffffd03h, cb1str fffffd13h, cb2str fffffd23h, cb3str fffffd33h, cb4str fffffd43h, cb5str fffffd53h ? during transmission, this register is set when data is prepared in the cbntx register, and during reception, it is set when a dummy read of the cbnrx register is performed. when transfer ends, this flag is cleared to 0 at the last edge of the clock. no overrun overrun cbnove 0 1 overrun error flag ? an overrun error occurs when the next reception starts without reading the value of the cbnrx register by cpu, upon completion of the receive operation. the cbnove flag displays the overrun error occurrence status in this case. ? the cbnove bit is valid also in the single transfer mode. therefore, when only using transmission, note the following. ? do not check the cbnove flag. (recommended) ? read this bit even if reading the reception data is not required. ? the cbnove flag is cleared by writing 0 to it. it cannot be set even by writing 1 to it. < > < > caution in single transfer mode, writing to th e cbntx register with the cbntsf bit set to 1 is ignored. this has no influence on the operation during transfer. for example, if the next data is written to the cbntx register when dma is started by generating the intcbnr signal, the written da ta is not transferred because the cbntsf bit is set to 1. use the continuous transfer mode, not the si ngle transfer mode, for such applications.
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 570 16.5 interrupt request signals csibn can generate the following two types of interrupt request signals. ? reception completion interrupt request signal (intcbnr) ? transmission enable interrupt request signal (intcbnt) of these two interrupt request signals, the reception completion interrupt request signal has the higher priority by default, and the priority of the transmission enable interrupt request signal is lower. table 16-2. interrupts and their default priority interrupt priority reception complete high transmission enable low (1) reception completion interr upt request signal (intcbnr) when receive data is transferred to the cbnrx register while reception is enabled, the reception completion interrupt request signal is generated. this interrupt request signal can also be generated if an overrun error occurs. when the reception completion interrupt request signal is acknowledged and the data is read, read the cbnstr register to check that the re sult of reception is not an error. in the single transfer mode, the intcbnr interrupt request signal is generated upon completion of transmission, even when only transmission is executed. (2) transmission enable interr upt request signal (intcbnt) in the continuous transmission or continuous transmi ssion/reception mode, transmit data is transferred from the cbntx register and, as soon as writing to cbntx has been enabled, the transmission enable interrupt request signal is generated. in the single transmission and single transmission/receptio n modes, the intcbnt interrupt is not generated.
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 571 16.6 operation 16.6.1 single transfer mode (m aster mode, transmission mode) msb first (cbnctl0.cbndir bit = 0), communication type 1 (cbnctl1.cbnckp and cbnctl1.cbndap bits = 00), communication clock (f cclk ) = f xx /2 (cbnctl1.cbncks2 to cbnctl1.cbncks0 bits = 000), transfer data length = 8 bits (cbnctl2.cbncl3 to cbnctl2.cbncl0 bits = 0000) (1) operation flow start no (1), (2), (3) (4) (5) (6) (8) no (7) intcbnr interrupt generated? transmission completed? end yes yes cbnctl1 register 00h cbnctl2 register 00h cbnctl0 register c1h write cbntx register start transmission cbnctl0 00h remarks 1. the broken lines indicate the hardware processing. 2. the numbers in this figure correspond to the processing numbers in (2) operation timing . 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 572 (2) operation timing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sckbn pin cbntsf bit (1) (2) (3) (4) (5) (6) (7) (8) sobn pin intcbnr signal (1) write 00h to the cbnctl1 register, and sele ct communication type 1, communication clock (f cclk ) = f xx /2, and master mode. (2) write 00h to the cbnctl2 register, and set the transfer data length to 8 bits. (3) write c1h to the cbnctl0 register, and select t he transmission mode and msb first at the same time as enabling the operation of the communication clock (f cclk ). (4) the cbnstr.cbntsf bit is set to 1 by writ ing the transmit data to the cbntx register, and transmission is started. (5) when transmission is started, output the serial clock to the sc kbn pin, and output the transmit data from the sobn pin in synchronization with the serial clock. (6) when transmission of the transfer data length se t with the cbnctl2 register is completed, stop the serial clock output and transmit data output, generate the reception completion interrupt request signal (intcbnr) at the last edge of the serial clock, and clear the cbntsf bit to 0. (7) to continue transmission, start the next transmission by writing the transmit dat a to the cbntx register again after the intcbnr signal is generated. (8) to end transmission, write the cbnctl0.cb npwr bit = 0 and the cbnctl0.cbntxe bit = 0. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 573 16.6.2 single transfer mode (master mode, reception mode) msb first (cbnctl0.cbndir bit = 0), communication type 1 (cbnctl1.cbnckp and cbnctl1.cbndap bits = 00), communication clock (f cclk ) = f xx /2 (cbnctl1.cbncks2 to cbnctl1.cbncks0 bits = 000), transfer data length = 8 bits (cbnctl2.cbncl3 to cbnctl2.cbncl0 bits = 0000) (1) operation flow start no intcbnr interrupt generated? reception completed? end yes yes no (7) cbnrx register dummy read cbnsce bit = 0 (cbnctl0) cbnctl0 register 00h read cbnrx register read cbnrx register cbnctl1 register 00h cbnctl2 register 00h cbnctl0 register a1h start reception (1), (2), (3) (4) (5) (6) (8) (9) (10) remarks 1. the broken lines indicate the hardware processing. 2. the numbers in this figure correspond to the processing numbers in (2) operation timing . 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 574 (2) operation timing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 sckbn pin cbntsf bit (1) (2) (3) (4) (5) (6) (7) (10) (8) (9) sibn pin sibn pin capture timing intcbnr signal (1) write 00h to the cbnctl1 register, and select communication type 1, communication clock (f cclk ) = f xx /2, and master mode. (2) write 00h to the cbnctl2 register, and set the transfer data length to 8 bits. (3) write a1h to the cbnctl0 register, and select t he reception mode and msb first at the same time as enabling the operation of the communication clock (f cclk ). (4) the cbnstr.cbntsf bit is set to 1 by per forming a dummy read of the cbnrx register, and reception is started. (5) when reception is started, out put the serial clock to the sckbn pi n, and capture the receive data of the sibn pin in synchronization with the serial clock. (6) when reception of the transfer data length set with the cbnctl2 regist er is completed, stop the serial clock output and data capturing, gener ate the reception completion interrupt request signal (intcbnr) at the last edge of the serial clo ck, and clear the cbntsf bit to 0. (7) to continue reception, read the cbnrx register with the cbnctl0.cbnsce bit = 1 remained after the intcbnr signal is generated. (8) to read the cbnrx register without starting the next reception, write the cbnsce bit = 0. (9) read the cbnrx register. (10) to end reception, write the cbnctl0.cbnpwr bit = 0 and the cbnctl0.cbnrxe bit = 0. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 575 16.6.3 single transfer mode (master mode, transmission/reception mode) msb first (cbnctl0.cbndir bit = 0), communication type 1 (cbnctl1.cbnckp and cbnctl1.cbndap bits = 00), communication clock (f cclk ) = f xx /2 (cbnctl1.cbncks2 to cbnctl1.cbncks0 bits = 000), transfer data length = 8 bits (cbnctl2.cbncl3 to cbnctl2.cbncl0 bits = 0000) (1) operation flow start (1), (2), (3) (4) (7), (9) (5) (6) (10) no (8) transmission/reception completed? end yes cbnctl1 register 00h cbnctl2 register 00h cbnctl0 register e1h write cbntx register read cbnrx register start transmission/reception cbnctl0 00h no intcbnr interrupt generated? yes yes remarks 1. the broken lines indicate the hardware processing. 2. the numbers in this figure correspond to the processing numbers in (2) operation timing . 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 576 (2) operation timing sckbn pin cbntsf bit (1) (2) (3) (4) (5) (6) (8) (7) (10) (9) sibn pin bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 0 sobn pin sibn pin capture timing intcbnr signal (1) write 00h to the cbnctl1 register, and sele ct communication type 1, communication clock (f cclk ) = f xx /2, and master mode. (2) write 00h to the cbnctl2 register, and set the transfer data length to 8 bits. (3) write e1h to the cbnctl0 register, and select the transmission/reception mode and msb first at the same time as enabling the operation of the communication clock (f cclk ). (4) the cbnstr.cbntsf bit is set to 1 by writ ing the transmit data to the cbntx register, and transmission/reception is started. (5) when transmission/reception is st arted, output the serial clock to the sckbn pin, output the transmit data to the sobn pin in synchronization with the seri al clock, and capture the re ceive data of the sibn pin. (6) when transmission/reception of t he transfer data length set with the cbnctl2 register is completed, stop the serial clock output, transmit data outpu t, and data capturing, generate the reception completion interrupt request signal (intcbnr) at t he last edge of the serial clock, and clear the cbntsf bit to 0. (7) read the cbnrx register. (8) to continue transmission/reception, write t he transmit data to the cbntx register again. (9) read the cbnrx register. (10) to end transmission/reception, write the cbnctl0.cbnpwr bit = 0, the cbnctl0.cbntxe bit = 0, and the cbnctl0.cbnrxe bit = 0. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 577 16.6.4 single transfer mode (s lave mode, transmission mode) msb first (cbnctl0.cbndir bit = 0), communication type 1 (cbnctl1.cbnckp and cbnctl1.cbndap bits = 00), communication clock (f cclk ) = external clock (sckbn) (cbnctl1.cbncks2 to cbnctl1.cbncks0 bits = 111), transfer data length = 8 bits (cbnctl2. cbncl3 to cbnctl2.cbncl0 bits = 0000) (1) operation flow start no (1), (2), (3) (4) (5) (4) (6) (8) no (7) intcbnr interrupt generated? transmission completed? end yes yes cbnctl1 register 07h cbnctl2 register 00h cbnctl0 register c1h write cbntx register start transmission cbnctl0 00h no yes sckbn pin input started? remarks 1. the broken lines indicate the hardware processing. 2. the numbers in this figure correspond to the processing numbers in (2) operation timing . 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 578 (2) operation timing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 0 sckbn pin cbntsf bit (1) (2) (3) (4) (5) (6) (7) (8) sobn pin intcbnr signal (1) write 07h to the cbnctl1 register, and sele ct communication type 1, communication clock (f cclk ) = external clock (sckbn), and slave mode. (2) write 00h to the cbnctl2 register, and set the transfer data length to 8 bits. (3) write c1h to the cbnctl0 register, and select t he transmission mode and msb first at the same time as enabling the operation of the communication clock (f cclk ). (4) the cbnstr.cbntsf bit is set to 1 by writing the transmit data to the cb ntx register, and the device waits for a serial clock input. (5) when a serial clock is input, output the transmit data from the sobn pin in synchronization with the serial clock. (6) when transmission of the transfer data length se t with the cbnctl2 register is completed, stop the serial clock input and transmit data output, generate the reception completion interrupt request signal (intcbnr) at the last edge of the serial clock, and clear the cbntsf bit to 0. (7) to continue transmission, write the transmit data to the cbntx register again after the intcbnr signal is generated, and wait for a serial clock input. (8) to end transmission, write the cbnctl0.cb npwr bit = 0 and the cbnctl0.cbntxe bit = 0. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 579 16.6.5 single transfer mode (slave mode, reception mode) msb first (cbnctl0.cbndir bit = 0), communication type 1 (cbnctl1.cbnckp and cbnctl1.cbndap bits = 00), communication clock (f cclk ) = external clock (sckbn) (cbnctl1.cbncks2 to cbnctl1.cbncks0 bits = 111), transfer data length = 8 bits (cbnctl2. cbncl3 to cbnctl2.cbncl0 bits = 0000) (1) operation flow start reception completed? end yes no (7) cbnrx register dummy read cbnsce bit = 0 (cbnctl0) cbnctl0 register 00h read cbnrx register read cbnrx register cbnctl1 register 07h cbnctl2 register 00h cbnctl0 register a1h start reception no intcbnr interrupt generated? yes no yes (1), (2), (3) (4) (5) (4) (6) (6) (8) (9) (10) sckbn pin input started? remarks 1. the broken lines indicate the hardware processing. 2. the numbers in this figure correspond to the processing numbers in (2) operation timing . 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 580 (2) operation timing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sckbn pin cbntsf bit (1) (2) (3) (4) (5) (6) (7) (10) (8) (9) sibn pin sibn pin capture timing intcbnr signal (1) write 07h to the cbnctl1 register, and select communication type 1, communication clock (f cclk ) = external clock (sckbn), and slave mode. (2) write 00h to the cbnctl2 register, and set the transfer data length to 8 bits. (3) write a1h to the cbnctl0 register, and select t he reception mode and msb first at the same time as enabling the operation of the communication clock (f cclk ). (4) the cbnstr.cbntsf bit is set to 1 by perf orming a dummy read of the cbnrx register, and the device waits for a serial clock input. (5) when a serial clock is input, capture the receive data of the sibn pin in syn chronization with the serial clock. (6) when reception of the transfer data length set with the cbnctl2 regist er is completed, stop the serial clock input and data capturing, generate the reception completion interrupt request signal (intcbnr) at the last edge of the serial clo ck, and clear the cbntsf bit to 0. (7) to continue reception, read the cbnrx register with the cbnctl0.cbnsce bit = 1 remained after the intcbnr signal is generated, and wait for a serial clock input. (8) to end reception, write the cbnsce bit = 0. (9) read the cbnrx register. (10) to end reception, write the cbnctl0.cbnpwr bit = 0 and the cbnctl0.cbnrxe bit = 0. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 581 16.6.6 single transfer mode (slave mode, transmission/reception mode) msb first (cbnctl0.cbndir bit = 0), communication type 1 (cbnctl1.cbnckp and cbnctl1.cbndap bits = 00), communication clock (f cclk ) = external clock (sckbn) (cbnctl1.cbncks2 to cbnctl1.cbncks0 bits = 111), transfer data length = 8 bits (cbnctl2. cbncl3 to cbnctl2.cbncl0 bits = 0000) (1) operation flow start (1), (2), (3) (4) (7), (9) (5) (4) (6) (10) no (8) transmission/reception completed? end yes cbnctl1 register 07h cbnctl2 register 00h cbnctl0 register e1h write cbntx register read cbnrx register start transmission/reception cbnctl0 00h no intcbnr interrupt generated? yes no yes sckbn pin input started? remarks 1. the broken lines indicate the hardware processing. 2. the numbers in this figure correspond to the processing numbers in (2) operation timing . 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 582 (2) operation timing sckbn pin cbntsf bit (1) (2) (3) (4) (5) (6) (8) (7) (10) (9) sibn pin bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sobn pin sibn pin capture timing intcbnr signal (1) write 07h to the cbnctl1 register, and select communication type 1, communication clock (f cclk ) = external clock (sckbn), and slave mode. (2) write 00h to the cbnctl2 register, and set the transfer data length to 8 bits. (3) write e1h to the cbnctl0 register, and select the transmission/reception mode and msb first at the same time as enabling the operation of the communication clock (f cclk ). (4) the cbnstr.cbntsf bit is set to 1 by writing the transmit data to the cb ntx register, and the device waits for a serial clock input. (5) when a serial clock is input, output the transmit dat a to the sobn pin in synchronization with the serial clock, and capture the receiv e data of the sibn pin. (6) when transmission/reception of the transfer data length set with the cbnctl2 register is completed, stop the serial clock input, transmit data output, and data capturing, generate the reception completion interrupt request signal (intcbnr) at the last edge of the serial clock, and clear the cbntsf bit to 0. (7) read the cbnrx register. (8) to continue transmission/reception, write the trans mit data to the cbntx regist er again, and wait for a serial clock input. (9) read the cbnrx register. (10) to end transmission/reception, write the cbnctl0.cbnpwr bit = 0, the cbnctl0.cbntxe bit = 0, and the cbnctl0.cbnrxe bit = 0. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 583 16.6.7 continuous transfer mode (master mode, transmission mode) msb first (cbnctl0.cbndir bit = 0), communication type 1 (cbnctl1.cbnckp and cbnctl1.cbndap bits = 00), communication clock (f cclk ) = f xx /2 (cbnctl1.cbncks2 to cbnctl1.cbncks0 bits = 000), transfer data length = 8 bits (cbnctl2.cbncl3 to cbnctl2.cbncl0 bits = 0000) (1) operation flow start (1), (2), (3) (4), (8) (5) (11) no (7) transmission completed? end yes cbnctl1 register 00h cbnctl2 register 00h cbnctl0 register c3h write cbntx register start transmission cbnctl0 00h no (6), (9) intcbnt interrupt generated? yes no (10) yes cbntsf bit = 0? (cbnstr register) remarks 1. the broken lines indicate the hardware processing. 2. the numbers in this figure correspond to the processing numbers in (2) operation timing . 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 584 (2) operation timing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sckbn pin cbntsf bit (1) (2) (3) (4) (5) (6) (7) (8) (9) (11) (10) sobn pin intcbnt signal intcbnr signal l bit 0 (1) write 00h to the cbnctl1 register, and select communication type 1, communication clock (f cclk ) = f xx /2, and master mode. (2) write 00h to the cbnctl2 register, and set the transfer data length to 8 bits. (3) write c3h to the cbnctl0 register, and select the transmission mode, msb first, and continuous transfer mode at the same time as enablin g the operation of the communication clock (f cclk ). (4) the cbnstr.cbntsf bit is se t to 1 by writing the transmit data to the cbntx register, and transmission is started. (5) when transmission is started, output the serial clock to the sc kbn pin, and output the transmit data from the sobn pin in synchronization with the serial clock. (6) when transfer of the transmit data from the cbnt x register to the shift register is completed and writing to the cbntx register is enabled, the transmission enable inte rrupt request signal (intcbnt) is generated. (7) to continue transmission, write the transmit data to the cbntx register again after the intcbnt signal is generated. (8) when a new transmit data is written to the cbntx register before communicat ion completion, the next communication is started following communication completion. (9) the transfer of the transmit data from the cbntx register to the shift register is completed and the intcbnt signal is generated. to end continuous transmission with the current transmission, do not write to the cbntx register. (10) when the next transmit data is not written to t he cbntx register before tr ansfer completion, stop the serial clock output to the sckbn pin after transf er completion, and clear the cbntsf bit to 0. (11) to release the transmission enable status , write the cbnctl0.cbnpwr bit = 0 and the cbnctl0.cbntxe bit = 0 after che cking that the cbntsf bit = 0. caution in continuous transm ission mode, the reception completi on interrupt request signal (intcbnr) is not generated. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 585 16.6.8 continuous transfer mode (master mode, reception mode) msb first (cbnctl0.cbndir bit = 0), communication type 1 (cbnctl1.cbnckp and cbnctl1.cbndap bits = 00), communication clock (f cclk ) = f xx /2 (cbnctl1.cbncks2 to cbnctl1.cbncks0 bits = 000), transfer data length = 8 bits (cbnctl2.cbncl3 to cbnctl2.cbncl0 bits = 0000)
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 586 (1) operation flow start no intcbnr interrupt generated? cbnove bit = 1? (cbnstr) end yes no yes cbnrx register dummy read cbnsce bit = 0 (cbnctl0) cbnove bit = 0 (cbnstr) read cbnrx register is data being received last data? yes cbnsce bit = 0 (cbnctl0) read cbnrx register cbnctl1 register 00h cbnctl2 register 00h cbnctl0 register a3h start reception (1), (2), (3) (4) (5) (6) (8) (9) (12) (13) (13) no read cbnrx register (9) (7) read cbnrx register no yes cbnctl0 register 00h no yes cbntsf bit = 0? (cbnstr) (9) (10) (11) (8) intcbnr interrupt generated? remarks 1. the broken lines indicate the hardware processing. 2. the numbers in this figure correspond to the processing numbers in ( 2) operation timing . 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 587 (2) operation timing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sckbn pin cbntsf bit (1) (2) (4) (3) (5) (6) (7) (8) (9) (11) (13) (10) sibn pin intcbnr signal cbnsce bit sobn pin l sibn pin capture timing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 (1) write 00h to the cbnctl1 register, and select communication type 1, communication clock (f cclk ) = f xx /2, and master mode. (2) write 00h to the cbnctl2 register, and set the transfer data length to 8 bits. (3) write a3h to the cbnctl0 register, and select t he reception mode, msb first, and continuous transfer mode at the same time as enabling the operation of the communication clock (f cclk ). (4) the cbnstr.cbntsf bit is set to 1 by per forming a dummy read of the cbnrx register, and reception is started. (5) when reception is started, output the serial clock to the sckbn pin, and capture the receive data of the sibn pin in synchronization with the serial clock. (6) when reception is completed, the reception co mpletion interrupt request signal (intcbnr) is generated, and reading of the cbnrx register is enabled. (7) when the cbnctl0.cbnsce bit = 1 upon communication completion, the next communication is started following communication completion. (8) to end continuous reception with the curr ent reception, write the cbnsce bit = 0. (9) read the cbnrx register. (10) when reception is completed, the intcbnr signa l is generated, and reading of the cbnrx register is enabled. when the cbnsce bit = 0 is set before communication completion, stop the serial clock output to the sckbn pin, and clear the cbntsf bit to 0, to end the receive operation. (11) read the cbnrx register. (12) if an overrun error occurs, write the cbns tr.cbnove bit = 0, and clear the error flag. (13) to release the reception enable status , write the cbnctl0.cbnpwr bit = 0 and the cbnctl0.cbnrxe bit = 0 after che cking that the cbntsf bit = 0. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 588 16.6.9 continuous transfer mode (mast er mode, transmissi on/reception mode) msb first (cbnctl0.cbndir bit = 0), communication type 1 (cbnctl1.cbnckp and cbnctl1.cbndap bits = 00), communication clock (f cclk ) = f xx /2 (cbnctl1.cbncks2 to cbnctl1.cbncks0 bits = 000), transfer data length = 8 bits (cbnctl2.cbncl3 to cbnctl2.cbncl0 bits = 0000)
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 589 (1) operation flow start end yes no is receive data last data? yes (12) no write cbntx register cbnove bit = 0 (cbnstr) read cbnrx register read cbnrx register cbnctl1 register 00h cbnctl2 register 00h cbnctl0 register e3h no (9) yes (1), (2), (3) (4) (5) (7) (11) (7) (6), (11) (8) (13) (13) (14) (15) (15) (10) no yes intcbnt interrupt generated? no yes cbntsf bit = 0? (cbnstr) write cbntx register yes no is data being transmitted last data? start transmission/reception cbnctl0 register 00h cbnove bit = 1? (cbnstr) intcbnr interrupt generated? remarks 1. the broken lines indicate the hardware processing. 2. the numbers in this figure correspond to the processing numbers in (2) operation timing . 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 590 (2) operation timing (1/2) sckbn pin cbntsf bit (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (13) (15) (12) sibn pin bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sobn pin intcbnt signal intcbnr signal sibn pin capture timing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 (1) write 00h to the cbnctl1 register, and select communication type 1, communication clock (f cclk ) = f xx /2, and master mode. (2) write 00h to the cbnctl2 register, and set the transfer data length to 8 bits. (3) write e3h to the cbnctl0 register, and select the transmission/reception mode, msb first, and continuous transfer mode at the same time as enabling the operation of the communication clock (f cclk ). (4) the cbnstr.cbntsf bit is se t to 1 by writing the transmit data to the cbntx register, and transmission/reception is started. (5) when transmission/reception is st arted, output the serial clock to the sckbn pin, output the transmit data to the sobn pin in synchronization with the seri al clock, and capture the receive data of the sibn pin. (6) when transfer of the transmit data from the cbntx register to the shift register is completed and writing to the cbntx register is enabled, the transmission enable inte rrupt request signal (intcbnt) is generated. (7) to continue transmission/reception, write the tr ansmit data to the cbntx register again after the intcbnt signal is generated. (8) when one transmission/reception is completed, the reception completion interrupt request signal (intcbnr) is generated, and reading of the cbnrx register is enabled. (9) when a new transmit data is written to the cbntx register before communicat ion completion, the next communication is started following communication completion. (10) read the cbnrx register. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 591 (2/2) (11) the transfer of the transmit data from the cbntx register to the shift register is completed and the intcbnt signal is generated. to end cont inuous transmission/reception with the current transmission/reception, do not wr ite to the cbntx register. (12) when the next transmit data is not written to t he cbntx register before tr ansfer completion, stop the serial clock output to the sckbn pin after transf er completion, and clear the cbntsf bit to 0. (13) when the reception error interrupt request si gnal (intcbnr) is generated, read the cbnrx register. (14) if an overrun error occurs, write the cbns tr.cbnove bit = 0, and clear the error flag. (15) to release the transmission/reception enable status, write the cbnctl0.cbnpwr bit = 0, the cbnctl0.cbntxe bit = 0, and the cbnctl0.cbnrxe bi t = 0 after checking that the cbntsf bit = 0. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 592 16.6.10 continuous transfer mode (slave mode, transmission mode) msb first (cbnctl0.cbndir bit = 0), communication type 1 (cbnctl1.cbnckp and cbnctl1.cbndap bits = 00), communication clock (f cclk ) = external clock (sckbn) (cbnctl1.cbncks2 to cbnctl1.cbncks0 bits = 111), transfer data length = 8 bits (cbnctl2. cbncl3 to cbnctl2.cbncl0 bits = 0000) (1) operation flow start (1), (2), (3) (4) (4) (5), (8) (11) no (7) transmission completed? end yes cbnctl1 register 07h cbnctl2 register 00h cbnctl0 register c3h write cbntx register start transmission cbnctl0 00h no (10) yes cbntsf bit = 0? (cbnstr register) no (6), (9) intcbnt interrupt generated? yes no (9) yes sckbn pin input started? remarks 1. the broken lines indicate the hardware processing. 2. the numbers in this figure correspond to the processing numbers in (2) operation timing . 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 593 (2) operation timing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sckbn pin cbntsf bit (1) (2) (3) (4) (5) (6) (7) (8) (9) (11) (10) sobn pin intcbnt signal bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 (1) write 07h to the cbnctl1 register, and select communication type 1, communication clock (f cclk ) = external clock (sckbn), and slave mode. (2) write 00h to the cbnctl2 register, and set the transfer data length to 8 bits. (3) write c3h to the cbnctl0 register, and select the transmission mode, msb first, and continuous transfer mode at the same time as enablin g the operation of the communication clock (f cclk ). (4) the cbnstr.cbntsf bit is set to 1 by writing the transmit data to the cb ntx register, and the device waits for a serial clock input. (5) when a serial clock is input, output the transmit data from the sobn pin in synchronization with the serial clock. (6) when transfer of the transmit data from the cbnt x register to the shift register is completed and writing to the cbntx register is enabled, the transmission enable inte rrupt request signal (intcbnt) is generated. (7) to continue transmission, write the transmit data to the cbntx register again after the intcbnt signal is generated. (8) when a serial clock is input following completion of the transmission of the transfer data length set with the cbnctl2 register, continu ous transmission is started. (9) when transfer of the transmit data from the cbnt x register to the shift register is completed and writing to the cbntx register is enabled, the in tcbnt signal is generated. to end continuous transmission with the current transmission, do not write to the cbntx register. (10) when the clock of the transfer dat a length set with the cbnctl2 register is input without writing to the cbntx register, clear the cbntsf bit to 0 to end transmission. (11) to release the transmission enable status , write the cbnctl0.cbnpwr bit = 0 and the cbnctl0.cbntxe bit = 0 after che cking that the cbntsf bit = 0. caution in continuous transmis sion mode, the reception completi on interrupt request signal (intcbnr) is not generated. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 594 16.6.11 continuous transfer m ode (slave mode, reception mode) msb first (cbnctl0.cbndir bit = 0), communication type 1 (cbnctl1.cbnckp and cbnctl1.cbndap bits = 00), communication clock (f cclk ) = external clock (sckbn) (cbnctl1.cbncks2 to cbnctl1.cbncks0 bits = 111), transfer data length = 8 bits (cbnctl2. cbncl3 to cbnctl2.cbncl0 bits = 0000)
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 595 (1) operation flow start no intcbnr interrupt generated? cbnove bit = 1? (cbnstr) end no yes yes cbnrx register dummy read cbnsce bit = 0 (cbnctl0) cbnove bit = 0 (cbnstr) read cbnrx register is data being received last data? yes cbnsce bit = 0 (cbnctl0) read cbnrx register cbnctl1 register 07h cbnctl2 register 00h cbnctl0 register a3h reception start (1), (2), (3) (4) (5) (4) (6) (8) (9) (12) (13) (13) no read cbnrx register (9) (7) read cbnrx register no yes cbnctl0 register 00h intcbnr interrupt generated? (9) (10) (11) (8) no yes cbntsf bit = 0? (cbnstr) no yes sckbn pin input started? remarks 1. the broken lines indicate the hardware processing. 2. the numbers in this figure correspond to the processing numbers in (2) operation timing . 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 596 (2) operation timing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sckbn pin cbntsf bit (1) (2) (4) (3) (5) (6) (7) (8) (9) (11) (13) (10) sibn pin intcbnr signal cbnsce bit sibn pin capture timing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 (1) write 07h to the cbnctl1 register, and select communication type 1, communication clock (f cclk ) = external clock (sckbn), and slave mode. (2) write 00h to the cbnctl2 register, and set the transfer data length to 8 bits. (3) write a3h to the cbnctl0 register, and select t he reception mode, msb first, and continuous transfer mode at the same time as enabling the operation of the communication clock (f cclk ). (4) the cbnstr.cbntsf bit is set to 1 by perf orming a dummy read of the cbnrx register, and the device waits for a serial clock input. (5) when a serial clock is input, capture the receive dat a of the sibn pin in synchronization with the serial clock. (6) when reception is completed, the reception co mpletion interrupt request signal (intcbnr) is generated, and reading of the cbnrx register is enabled. (7) when a serial clock is input in the cbnctl0.cbns ce bit = 1 status, continuous reception is started. (8) to end continuous reception with the curr ent reception, write the cbnsce bit = 0. (9) read the cbnrx register. (10) when reception is completed, the intcbnr signa l is generated, and reading of the cbnrx register is enabled. when the cbnsce bit = 0 is set before communication completion, clear the cbntsf bit to 0 to end the receive operation. (11) read the cbnrx register. (12) if an overrun error occurs, write the cbns tr.cbnove bit = 0, and clear the error flag. (13) to release the reception enable status , write the cbnctl0.cbnpwr bit = 0 and the cbnctl0.cbnrxe bit = 0 after che cking that the cbntsf bit = 0. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 597 16.6.12 continuous transfer mode (s lave mode, transmission/reception mode) msb first (cbnctl0.cbndir bit = 0), communication type 1 (cbnctl1.cbnckp and cbnctl1.cbndap bits = 00), communication clock (f cclk ) = external clock (sckbn) (cbnctl1.cbncks2 to cbnctl1.cbncks0 bits = 111), transfer data length = 8 bits (cbnctl2. cbncl3 to cbnctl2.cbncl0 bits = 0000)
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 598 (1) operation flow start end yes no is receive data last data? yes no write cbntx register cbnove bit = 0 (cbnstr) read cbnrx register read cbnrx register cbnctl1 register 07h cbnctl2 register 00h cbnctl0 register e3h no yes (1), (2), (3) (4) (5) (7) (11) (9) (7) (8) (13) (12) (13) (14) (15) (15) (10) no yes cbntsf bit = 0? (cbnstr) write cbntx register yes no is data being transmitted last data? start transmission/reception cbnctl0 register 00h cbnove bit = 1? (cbnstr) intcbnr interrupt generated? (6), (11) no yes intcbnt interrupt generated? (4) no yes sckbn pin input started? remarks 1. the broken lines indicate the hardware processing. 2. the numbers in this figure correspond to the processing numbers in (2) operation timing . 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 599 (2) operation timing (1/2) sckbn pin cbntsf bit (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (13) (15) (12) sibn pin bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 sobn pin intcbnt signal intcbnr signal sibn pin capture timing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 (1) write 07h to the cbnctl1 register, and select communication type 1, communication clock (f cclk ) = external clock (sckbn), and slave mode. (2) write 00h to the cbnctl2 register, and set the transfer data length to 8 bits. (3) write e3h to the cbnctl0 register, and select the transmission/reception mode, msb first, and continuous transfer mode at the same time as enabling the operation of the communication clock (f cclk ). (4) the cbnstr.cbntsf bit is set to 1 by writing the transmit data to the cb ntx register, and the device waits for a serial clock input. (5) when a serial clock is input, output the transmit dat a to the sobn pin in synchronization with the serial clock, and capture the receiv e data of the sibn pin. (6) when transfer of the transmit data from the cbnt x register to the shift register is completed and writing to the cbntx register is enabled, the transmission enable inte rrupt request signal (intcbnt) is generated. (7) to continue transmission, write the transmit data to the cbntx register again after the intcbnt signal is generated. (8) when reception of the transfer dat a length set with the cbnctl2 regist er is completed, the reception completion interrupt request signal (intcbnr) is ge nerated, and reading of the cbnrx register is enabled. (9) when a serial clock is input continuously, continuous transmission/re ception is started. (10) read the cbnrx register. (11) when transfer of the transmit data from the cbnt x register to the shift register is completed and writing to the cbntx register is enabled, the in tcbnt signal is generated. to end continuous transmission/reception with the current transmission/re ception, do not write to the cbntx register. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 600 (2/2) (12) when the clock of the transfer data length set with the cbnc tl2 register is input without writing to the cbntx register, the intcbnr signal is gener ated. clear the cbntsf bit to 0 to end transmission/reception. (13) when the intcbnr signal is generated, read the cbnrx register. (14) if an overrun error occurs, write the cbns tr.cbnove bit = 0, and clear the error flag. (15) to release the transmission/reception enable status, write the cbnctl0.cbnpwr bit = 0, the cbnctl0.cbntxe bit = 0, and the cbnctl0.cbnrxe bi t = 0 after checking that the cbntsf bit = 0. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 601 16.6.13 reception error when transfer is performed with reception enabled (cbnctl0. cbnrxe bit = 1) in the continuous transfer mode, the reception completion interrupt requ est signal (intcbnr) is generated again when the next receive operation is completed before the cbnrx register is read after the intcbnr signal is generated, and the overrun error flag (cbnstr.cbnove) is set to 1. even if an overrun error has occurred, the previous receive data is lost since the cbnrx register is updated. even if a reception error has occurred, the intcbnr signal is generated again upon the next re ception completion if the cbnrx register is not read. to avoid an overrun error, complete reading the cbnrx r egister until one half clock before sampling the last bit of the next receive data from the intcbnr signal generation. (1) operation timing sckbn pin cbnrx register read signal (1) (2) (4) 01h 02h 05h 0ah 15h 2ah 55h aah 00h 01h 02h 05h 0ah 15h 2ah 55h shift register aah 55h cbnrx register sibn pin intcbnr signal cbnove bit sibn pin capture timing (3) (1) start continuous transfer. (2) completion of the first transfer (3) the cbnrx register cannot be read until one hal f clock before the completion of the second transfer. (4) an overrun error occurs, and the reception completion interrupt request signal (intcbnr) is generated, and then the overrun error flag (cbnst r.cbnove) is set to 1. the receive data is overwritten. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 602 16.6.14 clock timing (1/2) (i) communication type 1 ( cbnckp and cbndap bits = 00) d6 d5 d4 d3 d2 d1 sckbn pin sibn capture reg-r/w sobn pin intcbnt interrupt note 1 intcbnr interrupt note 2 cbntsf bit d0 d7 (ii) communication type 3 (cbnckp and cbndap bits = 10) d6 d5 d4 d3 d2 d1 d0 d7 sckbn pin sibn capture reg-r/w sobn pin intcbnt interrupt note 1 intcbnr interrupt note 2 cbntsf bit notes 1. the intcbnt interrupt is set when the data written to the cbntx register is transferred to the data shift register in the continuous transmission or continuous transmission/reception mode. in the single transmission or single transmission/reception mode, the intcbnt interrupt request signal is not generated, but the intcbnr interrupt request signal is generated upon end of communication. 2. the intcbnr interrupt occurs if reception is correctly ended and receive data is ready in the cbnrx register while reception is enabled. in the single mode, the intcbnr interrupt request signal is generated even in the transmission mode, upon end of communication. caution in single transfer mode, writing to the cbntx register with the cbntsf bit set to 1 is ignored. this has no influence on the operation during transfer. for example, if the next data is written to the cbntx register when dma is started by generating the intcbnr signal, th e written data is not transfe rred because the cbntsf bit is set to 1. use the continuous transfer mode, not the si ngle transfer mode, for such applications.
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 603 (2/2) (iii) communication type 2 (cbnckp and cbndap bits = 01) d6 d5 d4 d3 d2 d1 d0 d7 sckbn pin sibn capture reg-r/w sobn pin intcbnt interrupt note 1 intcbnr interrupt note 2 cbntsf bit (iv) communication type 4 (cbnckp and cbndap bits = 11) d6 d5 d4 d3 d2 d1 d0 d7 sckbn pin sibn capture reg-r/w sobn pin intcbnt interrupt note 1 intcbnr interrupt note 2 cbntsf bit notes 1. the intcbnt interrupt is set when the data written to the cbntx register is transferred to the data shift register in the continuous transmission or continuous transmission/reception modes. in the single transmission or single transmission/receptio n modes, the intcbnt interrupt request signal is not generated, but the intcbnr interrupt request signal is generated upon end of communication. 2. the intcbnr interrupt occurs if reception is correctly ended and receive data is ready in the cbnrx register while reception is enabled. in the single mode, the intcbnr interrupt request signal is generated even in the transmission mode, upon end of communication. caution in single transfer mode, writing to the cbntx register with the cbntsf bi t set to 1 is ignored. this has no influence on the operation during transfer. for example, if the next data is written to the cbntx register when dma is started by generating the intcbnr signal, th e written data is not transfe rred because the cbntsf bit is set to 1. use the continuous transfer mode, not the si ngle transfer mode, for such applications.
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 604 16.7 output pins (1) sckbn pin when csibn operation is disabled (cbnctl0.cbnpwr bit = 0), the sckbn pin output status is as follows. cbnckp cbncks2 cbncks1 cbncks0 sckbn pin output 1 1 1 high impedance 0 other than above fixed to high level 1 1 1 high impedance 1 other than above fixed to low level remarks 1. the output level of the sckbn pin changes if any of the cbnctl1.cbnckp and cbncks2 to cbncks0 bits is rewritten. 2. n = 0 to 5 (2) sobn pin when csibn operation is disabled (cbnpwr bit = 0), the sobn pin output status is as follows. cbntxe cbndap cbndir sobn pin output 0 fixed to low level 0 sobn latch value (low level) 0 cbntx0 value (msb) 1 1 1 cbntx0 value (lsb) remarks 1. the sobn pin output chan ges when any one of the cbnctl0.cbntxe, cbnctl0.cbndir bits, and cbnctl1.cbndap bit is rewritten. 2. : don?t care 3. n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 605 16.8 baud rate generator the brg1 to brg3 and csib0 to csib5 baud rate generators are connected as shown in the following block diagram. csib0 csib1 csib2 csib3 csib4 brg1 brg2 brg3 csib5 f x f x f x f brg1 f brg2 f brg3 (1) brgm prescaler mode register (prsmm) the prsmm register controls generation of the baud rate signal for csib. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 prsmm (m = 1 to 3) 0 0 bgcem 0 0 bgcsm1 bgcsm0 disabled enabled bgcem 0 1 baud rate output f xx f xx /2 f xx /4 f xx /8 setting value (k) 0 1 2 3 bgcsm1 0 0 1 1 bgcsm0 0 1 0 1 input clock selection (f bgcsm ) after reset: 00h r/w address: prsm1 fffff320h, prsm2 fffff324h, prsm3 fffff328h < > cautions 1. do not rewrite the prsmm register during operation. 2. set the prsmm register befo re setting the bgcem bit to 1.
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 606 (2) brgm prescaler compare register (prscmm) the prscmm register is an 8-bit compare register. this register can be read or written in 8-bit units. reset sets this register to 00h. prscmm7 prscmm (m = 1 to 3) prscmm6 prscmm5 prscmm4 prscmm3 prscmm2 prscmm1 prscmm0 after reset: 00h r/w address: prscm1 fffff321h, prscm2 fffff325h, prscm3 fffff329h cautions 1. do not rewrite the pr scmm register during operation. 2. set the prscmm register before setting the prsmm.bgcem bit to 1. 16.8.1 baud rate generation the transmission/reception clock is generated by dividing the main clock. the baud rate generated from the main clock is obtained by the following equation. f brgm = caution set f brgm to 8 mhz or lower. remark f brgm : brgm count clock f xx : main clock frequency k: prsmm register setting value = 0 to 3 n: prscmm register setting value = 1 to 256 however, n = 256 only when prscmm register is set to 00h. m = 1 to 3 f xx 2 k+1 n
chapter 16 3-wire variable-length serial i/o (csib) user?s manual u16603ej5v1ud 607 16.9 cautions (1) when transferring transmit data and receive data using dma transfer, error processing cannot be performed even if an overrun error occurs during serial transf er. check that the no overrun error has occurred by reading the cbnstr.cbnove bit after dma transfer has been completed. (2) in regards to registers that are forbidden from being rewritten during op erations (cbnctl0.cbnpwr bit is 1), if rewriting has been carried out by mistake during ope rations, set the cbnctl0.cbnpwr bit to 0 once, then initialize csibn. registers to which rewriting during op eration are prohibited are shown below. ? cbnctl0 register: cbntxe, cbnrxe, cbndir, cbntms bits ? cbnctl1 register: cbnckp, cbndap, cbncks2 to cbncks0 bits ? cbnctl2 register: cbncl3 to cbncl0 bits (3) in communication type 2 or 4 (cbnctl1.cbndap bit = 1), the cbnstr.cbntsf bit is cleared half an sckbn clock after occurrence of a receptio n completion interrupt (intcbnr). in the single transfer mode, writing the next transmit data is ignored during communication (cbntsf bit = 1), and the next communication is not started. also if receive-only communication (cbnctl0.cbntxe bit = 0, cbnctl0.cbnrxe bit = 1) is set, the next communication is not started even if the receive data is read during communication (cbntsf bit = 1). therefore, when using the single transfer mode with communication type 2 or 4 (cbndap bit = 1), pay particular attention to the following. ? to start the next transmission, confirm that cbntsf bit = 0 and then write the transmit data to the cbntx register. ? to perform the next reception continuously when re ceive-only communication (cbntxe bit = 0, cbnrxe bit = 1) is set, confirm that cbntsf bi t = 0 and then read the cbnrx register. or, use the continuous transfer mode inst ead of the single transfer mode. us e of the continuous transfer mode is recommended especially for using dma. remark n = 0 to 5
user?s manual u16603ej5v1ud 608 chapter 17 i 2 c bus the contents of this chapter only apply to i 2 c bus version (y products). to use the i 2 c bus function, use the p38/ sda00, p40/sda01, and p90/sd a02 pins as the serial transmit/receive data i/o pins, and the p39/scl00, p41/ scl01, and p91/scl02 pins as the serial clock i/o pins, and set them to n-ch open-drain output. 17.1 mode switching of i 2 c bus and other serial interfaces 17.1.1 uarta2 and i 2 c00 mode switching in the v850es/sj2 and v850es/sj2-h, uarta2 and i 2 c00 are alternate functions of the same pin and therefore cannot be used simultaneously. set i 2 c00 in advance, using the pmc3 and pfc3 registers, before use. caution the transmit/receive operation of uarta2 and i 2 c00 is not guaranteed if these functions are switched during transmission or reception. be sure to disable the one that is not used. figure 17-1. uarta2 and i 2 c00 mode switch settings pmc3 after reset: 0000h r/w address: fffff446h, fffff447h pmc37 pmc36 pmc35 pmc34 pmc33 pmc32 pmc31 pmc30 0 0 0 0 0 0 pmc39 pmc38 8 9 10 11 12 13 14 15 pfc3 after reset: 0000h r/w address: fffff466h, fffff467h 0 0 0 0 0 0 pfc39 pfc38 pfc37 pfc36 pfc35 pfc34 pfc33 pfc32 pfc31 pfc30 8 9 10 11 12 13 14 15 port i/o mode uarta2 mode i 2 c00 mode pmc3n 0 1 1 operation mode pfc3n 0 1 remarks 1. n = 8, 9 2. = don?t care
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 609 17.1.2 csib0 and i 2 c01 mode switching in the v850es/sj2 and v 850es/sj2-h, csib0 and i 2 c01 are alternate functions of the same pin and therefore cannot be used simultaneously. set i 2 c01 in advance, using the pmc4 and pfc4 registers, before use. caution the transmit/receive operation of csib0 and i 2 c01 is not guaranteed if these functions are switched during transmission or reception. be sure to disable the one that is not used. figure 17-2. csib0 and i 2 c01 mode switch settings port i/o mode csib0 mode i 2 c01 mode pmc4n 0 1 1 operation mode pfc4n 0 1 0 pmc4 0 0 0 0 pmc42 pmc41 pmc40 after reset: 00h r/w address: fffff448h pfc4 after reset: 00h r/w address: fffff468h 0 0 0 0 0 0 pfc41 pfc40 remarks 1. n = 0, 1 2. = don?t care
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 610 17.1.3 uarta1 and i 2 c02 mode switching in the v850es/sj2 and v850es/sj2-h, uarta1 and i 2 c02 are alternate functions of the same pin and therefore cannot be used simultaneously. set i 2 c02 in advance, using the pmc9, pfc9 , and pmce9 registers, before use. caution the transmit/receive operation of uarta1 and i 2 c02 is not guaranteed if these functions are switched during transmission or reception. be sure to disable the one that is not used. figure 17-3. uarta1 and i 2 c02 mode switch settings pmc9 after reset: 0000h r/w address: fffff452h, fffff453h pmc97 pmc96 pmc95 pmc94 pmc93 pmc92 pmc91 pmc90 pmc915 pmc914 pmc913 pmc912 pmc911 pmc910 pmc99 pmc98 8 9 10 11 12 13 14 15 pfc9 after reset: 0000h r/w address: fffff472h, fffff473h pfc915 pfc914 pfc913 pfc912 pfc911 pfc910 pfc99 pfc98 pfc97 pfc96 pfc95 pfc94 pfc93 pfc92 pfc91 pfc90 8 9 10 11 12 13 14 15 pfce915 pfce914 0 0 0 0 0 0 pfce97 pfce96 pfce95 pfce94 pfce93 pfce92 pfce91 pfce90 8 9 10 11 12 13 14 15 pfce9 after reset: 0000h r/w address: fffff712h, fffff713h uarta1 mode i 2 c02 mode pmc9n 1 1 operation mode pfce9n 1 1 pfc9n 0 1 remark n = 0, 1
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 611 17.2 features i 2 c00 to i 2 c02 have the following two modes. ? operation stopped mode ? i 2 c (inter ic) bus mode (multimasters supported) (1) operation stopped mode in this mode, serial transfers are not performed, thus enabling a reduction in power consumption. (2) i 2 c bus mode (multimaster support) this mode is used for 8-bit data transfers with several devices via two lines: a serial clock pin (scl0n) and a serial data bus pin (sda0n). this mode complies with the i 2 c bus format and the master device can generate ?start condition?, ?address?, ?transfer direction specification?, ? data?, and ?stop condition? data to the sl ave device via the serial data bus. the slave device automatically detects the received status es and data by hardware. this function can simplify the part of an application progr am that controls the i 2 c bus. since scl0n and sda0n pins are us ed for n-ch open-drain outputs, i 2 c0n requires pull-up resistors for the serial clock line and the serial data bus line. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 612 17.3 configuration the block diagram of the i 2 c0n is shown below. figure 17-4. block diagram of i 2 c0n internal bus iic status register n (iicsn) iic control register n (iiccn) so latch iicen dq cln1, cln0 trcn dfcn dfcn sda0n scl0n output control intiicn iic shift register n (iicn) iiccn.sttn, sptn iicsn.mstsn, excn, coin iicsn.mstsn, excn, coin lreln wreln spien wtimn acken sttn sptn mstsn aldn excn coin trcn ackdn stdn spdn internal bus cldn dadn smcn dfcn cln1 cln0 clxn iic clock select register n (iiccln) stcfn iicbsyn stcenn iicrsvn iic flag register n (iicfn) iic function expansion register n (iicxn) f xx iic division clock select register m (ocksm) f xx to f xx /5 ocksthm ocksenm ocksm1 ocksm0 clear slave address register n (svan) match signal set noise eliminator iic shift register n (iicn) data retention time correction circuit n-ch open-drain output acknowledge detector acknowledge generator start condition detector stop condition detector serial clock counter serial clock controller noise eliminator n-ch open-drain output start condition generator stop condition generator wakeup controller interrupt request signal generator serial clock wait controller bus status detector prescaler prescaler remark n = 0 to 2 m = 0, 1
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 613 a serial bus configuration example is shown below. figure 17-5. serial bus configuration example using i 2 c bus sda scl sda +v dd +v dd scl sda scl slave cpu3 address 3 sda scl slave ic address 4 sda scl slave ic address n master cpu1 slave cpu1 address 1 serial data bus serial clock master cpu2 slave cpu2 address 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 614 i 2 c0n includes the following hardware (n = 0 to 2). table 17-1. configuration of i 2 c0n item configuration registers iic shift register n (iicn) slave address register n (svan) control registers iic control register n (iiccn) iic status register n (iicsn) iic flag register n (iicf0n) iic clock select register n (iiccln) iic function expansion register n (iicxn) iic division clock select registers 0, 1 (ocks0, ocks1) (1) iic shift register n (iicn) the iicn register converts 8-bit serial data into 8- bit parallel data and vice versa, and can be used for both transmission and reception (n = 0 to 2). write and read operations to the iicn r egister are used to control the act ual transmit and receive operations. this register can be read or written in 8-bit units. reset input clears this register to 00h. (2) slave address register n (svan) the svan register sets local addresses when in slave mode (n = 0 to 2). this register can be read or written in 8-bit units. reset input clears this register to 00h. (3) so latch the so latch is used to retain the output level of the sda0n pin (n = 0 to 2). (4) wakeup controller this circuit generates an interrupt r equest signal (intiicn) when the address re ceived by this register matches the address value set to the svan register or w hen an extension code is received (n = 0 to 2). (5) prescaler this selects the sampling clock to be used. (6) serial clock counter this counter counts the serial clocks that are output and the serial clocks t hat are input during transmit/receive operations and is used to verify that 8-bit data was transmitted or received.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 615 (7) interrupt request signal generator this circuit controls the generation of interrupt request signals (intiicn). an i 2 c interrupt is generated followi ng either of two triggers. ? falling edge of eighth or ninth clock of the serial clock (set by iiccn.wtimn bit) ? interrupt occurrence due to stop conditi on detection (set by iiccn.spien bit) remark n = 0 to 2 (8) serial clock controller in master mode, this circuit generates the clock output via the scl0n pin from the sampling clock (n = 0 to 2). (9) serial clock wait controller this circuit controls the wait timing. (10) ack generator, stop condition detector, start condition detector, and ack detector these circuits are used to gener ate and detect various statuses. (11) data hold time correction circuit this circuit generates the hold time for data corresponding to the falling edge of the scl0n pin. (12) start condition generator a start condition is generated when the iiccn.sttn bit is set. however, in the communication reservation disabled st atus (iicfn.iicrsvn bit = 1), this request is ignored and the iicfn.stcfn bit is set to 1 if the bus is not released (iicfn.iicbsyn bit = 1). (13) stop condition generator a stop condition is generated when t he iiccn.sptn bit is set (1). (14) bus status detector whether the bus is released or not is ascertai ned by detecting a start c ondition and stop condition. however, the bus status c annot be detected immediately a fter operation, so set the bus status detector to the initial status by using the iicfn.stcenn bit.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 616 17.4 registers i 2 c00 to i 2 c02 are controlled by t he following registers. ? iic control registers 0 to 2 (iicc0 to iicc2) ? iic status registers 0 to 2 (iics0 to iics2) ? iic flag registers 0 to 2 (iicf0 to iicf2) ? iic clock select registers 0 to 2 (iiccl0 to iiccl2) ? iic function expansion registers 0 to 2 (iicx0 to iicx2) ? iic division clock select r egisters 0, 1 (ocks0, ocks1) the following registers are also used. ? iic shift registers 0 to 2 (iic0 to iic2) ? slave address registers 0 to 2 (sva0 to sva2) remark for the alternate-function pin settings, see table 4-19 using port pin as alternate-function pin . (1) iic control registers 0 to 2 (iicc0 to iicc2) the iicc0 to iicc2 registers enable/stop i 2 c0n operations, set the wait timing, and set other i 2 c operations (n = 0 to 2). these registers can be read or written in 8-bit or 1-bit units. howe ver, set the spien, wtimn, and acken bits when the iicen bit is 0 or during the wa it period. when setting the iicen bit fr om ?0? to ?1?, these bits can also be set at the same time. reset sets these registers to 00h.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 617 (1/4) after reset: 00h r/w address: iicc0 fffffd82h, iicc1 fffffd92h, iicc2 fffffda2h <7> <6> <5> <4> <3> <2> <1> <0> iiccn iicen lreln wreln spien wtimn acken sttn sptn (n = 0 to 2) iicen specification of i 2 cn operation enable/disable 0 operation stopped. iicsn register reset note 1 . internal operation stopped. 1 operation enabled. be sure to set this bit to 1 when the scl0n and sda0n lines are high level. condition for clearing (iicen bit = 0) condition for setting (iicen bit = 1) ? cleared by instruction ? after reset ? set by instruction lreln note 2 exit from communications 0 normal operation 1 this exits from the current communication oper ation and sets standby mode. this setting is automatically cleared after being ex ecuted. its uses include cases in which a locally irrelevant extension code has been received. the scl0n and sda0n lines are set to high impedance. the sttn and sptn bits and the mstsn, excn, coin , trcn, ackdn, and stdn bits of the iicsn register are cleared. the standby mode following exit from communications rema ins in effect until the following communication entry conditions are met. ? after a stop condition is detected, restart is in master mode. ? an address match occurs or an extension code is received after the start condition. condition for clearing (lreln bit = 0) condition for setting (lreln bit = 1) ? automatically cleared after execution ? after reset ? set by instruction wreln note 2 wait state cancellation control 0 wait state not canceled 1 wait state canceled. this setting is automat ically cleared after wait state is canceled. condition for clearing (wreln bit = 0) condition for setting (wreln bit = 1) ? automatically cleared after execution ? after reset ? set by instruction notes 1. the iicsn register, iicfn.s tcfn and iicfn.iicbsyn bits, and iiccln.cldn and iiccln.dadn bits are reset. 2. this flag?s signal is invalid when the iicen bit = 0. caution if the i 2 cn operation is enabled (iicen bit = 1) when the scl0n line is high level and the sda0n line is low level, the start condition is detected immediately. to avoid this, after enabling the i 2 cn operation, immediately set the lr eln bit to 1 with a bit manipulation instruction. remark the lreln and wreln bits are 0 when read after the data has been set.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 618 (2/4) spien note enable/disable generation of interrupt request when stop condition is detected 0 disabled 1 enabled condition for clearing (spien bit = 0) condition for setting (spien bit = 1) ? cleared by instruction ? after reset ? set by instruction wtimn note control of wait state and interrupt request generation 0 interrupt request is generated at the eighth clock?s falling edge. master mode: after output of eight clocks, clock output is set to low level and the wait state is set. slave mode: after input of eight clocks, the clock is set to low level and the wait state is set for the master device. 1 interrupt request is generated at the ninth clock?s falling edge. master mode: after output of nine clocks, clock output is set to low level and the wait state is set. slave mode: after input of nine clocks, the clock is set to low level and the wait state is set for the master device. during address transfer, an interrupt occurs at the falling edge of the ninth clock regardless of this bit setting. this bit setting becomes valid when the address transfer is complet ed. in master mode, a wait state is inserted at the falling edge of the ninth clock during address transfer. for a slave device that has rece ived a local address, a wait state is inserted at the falling edge of the ninth clock a fter ack is generated. when t he slave device has received an extension code, however, a wait state is inserted at the falling edge of the eighth clock. condition for clearing (wtimn bit = 0) condition for setting (wtimn bit = 1) ? cleared by instruction ? after reset ? set by instruction acken note acknowledgment control 0 acknowledgment disabled. 1 acknowledgment enabled. during t he ninth clock period, the sda0n line is set to low level. the acken bit setting is invalid for address reception. in this case, ack is generated when the addresses match. however, the acken bit setting is valid for reception of the extension code. condition for clearing (acken bit = 0) condition for setting (acken bit = 1) ? cleared by instruction ? after reset ? set by instruction note this flag?s signal is invalid when the iicen bit = 0. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 619 (3/4) sttn start condition trigger 0 start condition is not generated. 1 when bus is released (in stop mode): a start condition is generated (for st arting as master). the sda0n line is changed from high level to low level while the scln line is high level and then the start condition is generated. next, after the rated amount of time has elapsed, the scl0n line is changed to low level (wait state). during communication with a third party: ? if the communication reservation func tion is enabled (iicfn.iicrsvn bit = 0) ? this trigger functions as a st art condition reserve flag. when se t to 1, it releases the bus and then automatically generat es a start condition. ? if the communication reservation f unction is disabled (iicrsvn = 1) ? the iicfn.stcfn bit is set to 1 and information se t (1) to the sttn bit is cleared. this trigger does not generate a start condition. in the wait state (when master device): a restart condition is generated afte r the wait state is released. cautions concerning set timing for master reception: cannot be set to 1 during transfer. can be set to 1 only when the acken bit has been set to 0 and the slave has been notified of final reception. for master transmission: a start condition cannot be generat ed normally during the ack period. set to 1 during the wait period that follows output of the ninth clock. for slave: even when the communication reservati on function is disabled (iicrsvn bit = 1), the communication reservation status is entered. ? setting to 1 at the same time as the sptn bit is prohibited. ? when the sttn bit is set to 1, setting the sttn bit to 1 again is disabled until the setting is cleared to 0. condition for clearing (sttn bit = 0) condition for setting (sttn bit = 1) ? when the sttn bit is set to 1 in the communication reservation disabled status ? cleared by loss in arbitration ? cleared by start condition generation in the master device ? when the lreln bit = 1 (communication save) ? when the iicen bit = 0 (operation stop) ? after reset ? set by instruction remarks 1. the sttn bit is 0 if it is read immediately after data setting. 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 620 (4/4) sptn stop condition trigger 0 stop condition is not generated. 1 stop condition is generated (terminati on of master device?s transfer). after the sda0n line goes to low level, either set the scl0n line to high level or wait until the scl0n pin goes to high level. next, after the rated am ount of time has elapsed, the sda0n line is changed from low level to high level and a stop condition is generated. cautions concerning set timing for master reception: cannot be set to 1 during transfer. can be set to 1 only when the acken bit has been set to 0 and during the wait period after the slave has been notified of final reception. for master transmission: a stop condition cannot be generat ed normally during the ack reception period. set to 1 during the wait period that follows output of the ninth clock. ? cannot be set to 1 at the same time as the sttn bit. ? the sptn bit can be set to 1 only when in master mode note . ? when the wtimn bit has been set to 0, if the sptn bit is set to 1 during the wait period that follows output of eight clocks, note that a stop condition will be generated during the high-level period of the ninth clock. the wtimn bit should be changed from 0 to 1 during the wait period following output of eight clocks, and the sptn bit should be set to 1 during the wait peri od that follows output of the ninth clock. ? when the sptn bit is set to 1, setting the sptn bit to 1 again is disabled until the setting is cleared to 0. condition for clearing (sptn bit = 0) condition for setting (sptn bit = 1) ? cleared by loss in arbitration ? automatically cleared after stop condition is detected ? when the lreln bit = 1 (communication save) ? when the iicen bit = 0 (operation stop) ? after reset ? set by instruction note set the sptn bit to 1 only in master mode. howeve r, when the iicrsvn bit is 0, the sptn bit must be set to 1 and a stop condition generated before the first stop condition is detected following the switch to the operation enabled status . for details, see 17.15 cautions . caution when the trcn bit = 1, the wreln bit is set to 1 during the ninth clock and the wait state is canceled, after which the t rcn bit is cleared to 0 and the sda0n line is set to high impedance. remarks 1. the sptn bit is 0 if it is r ead immediately after data setting. 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 621 (2) iic status registers 0 to 2 (iics0 to iics2) the iics0 to iics2 registers i ndicate the status of the i 2 c0n bus (n = 0 to 2). these registers are read-only, in 8-bit or 1-bit units. however, t he iicsn register can only be read when the iiccn.sttn bit is 1 or during the wait period. reset sets these registers to 00h. caution accessing the iicsn register is prohibited in the following stat uses. for details, see 3.4.9 (2) accessing specific on-chip pe ripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock (1/3) after reset: 00h r address: iics0 fffffd86h, iics1 fffffd96h, iics2 fffffda6h <7> <6> <5> <4> <3> <2> <1> <0> iicsn mstsn aldn excn coin trcn ackdn stdn spdn (n = 0 to 2) mstsn master device status 0 slave device status or communication standby status 1 master device communication status condition for clearing (mstsn bit = 0) condition for setting (mstsn bit = 1) ? when a stop condition is detected ? when the aldn bit = 1 (arbitration loss) ? cleared by lreln bit = 1 (communication save) ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? when a start condition is generated aldn arbitration loss detection 0 this status means either that there was no arbitr ation or that the arbitration result was a ?win?. 1 this status indicates the arbitration result was a ?loss?. the mstsn bit is cleared to 0. condition for clearing (aldn bit = 0) condition for setting (aldn bit = 1) ? automatically cleared after the iicsn register is read note ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? when the arbitration result is a ?loss?. excn detection of extension code reception 0 extension code was not received. 1 extension code was received. condition for clearing (excn bit = 0) condition for setting (excn bit = 1) ? when a start condition is detected ? when a stop condition is detected ? cleared by lreln bit = 1 (communication save) ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? when the higher four bits of the received address data are either ?0000? or ?1111? (set at the rising edge of the eighth clock). note the aldn bit is also cleared when a bit manipulat ion instruction is execut ed for another bit in the iicsn register.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 622 (2/3) coin matching address detection 0 addresses do not match. 1 addresses match. condition for clearing (coin bit = 0) condition for setting (coin bit = 1) ? when a start condition is detected ? when a stop condition is detected ? cleared by lreln bit = 1 (communication save) ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? when the received address matches the local address (svan register) (set at the rising edge of the eighth clock). trcn transmit/receive status detection 0 receive status (other than transmit status ). the sda0n line is set to high impedance. 1 transmit status. the value in t he so latch is enabled for output to the sda0n line (valid starting at the falling edge of the first byte?s ninth clock). condition for clearing (trcn bit = 0) condition for setting (trcn bit = 1) ? when a stop condition is detected ? cleared by lreln bit = 1 (communication save) ? when the iicen bit changes from 1 to 0 (operation stop) ? cleared by iiccn.wreln bit = 1 note ? when the aldn bit changes from 0 to 1 (arbitration loss) ? after reset master ? when ?1? is output to the first byte?s lsb (transfer direction specification bit) slave ? when a start condition is detected when not used for communication master ? when a start condition is generated ? when ?0? is output to the first byte?s lsb (transfer direction specification bit) slave ? when ?1? is input by the first byte?s lsb (transfer direction specification bit) ackdn ack detection 0 ack was not detected. 1 ack was detected. condition for clearing (ackdn bit = 0) condition for setting (ackd bit = 1) ? when a stop condition is detected ? at the rising edge of the next byte?s first clock ? cleared by lreln bit = 1 (communication save) ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? after the sda0n bit is set to low level at the rising edge of the scl0n pin?s ninth clock note the trcn bit is cleared to 0 and sda0n line bec omes high impedance when the wreln bit is set to 1 and the wait state is canceled to 0 at the ninth clock by trcn bit = 1. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 623 (3/3) stdn start condition detection 0 start condition was not detected. 1 start condition was detected. this indicates that the address transfer period is in effect condition for clearing (stdn bit = 0) condition for setting (stdn bit = 1) ? when a stop condition is detected ? at the rising edge of the next byte?s first clock following address transfer ? cleared by lreln bit = 1 (communication save) ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? when a start condition is detected spdn stop condition detection 0 stop condition was not detected. 1 stop condition was detected. the master devic e?s communication is terminated and the bus is released. condition for clearing (spdn bit = 0) condition for setting (spdn bit = 1) ? at the rising edge of the address transfer byte?s first clock following setting of this bit and detection of a start condition ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? when a stop condition is detected remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 624 (3) iic flag registers 0 to 2 (iicf0 to iicf2) the iicf0 to iicf2 registers set the i 2 c0n operation mode and indicate the i 2 c bus status. these registers can be read or writt en in 8-bit or 1-bit units. howeve r, the stcfn and iicbsyn bits are read- only. iicrsvn enables/disables the communi cation reservation function (see 17.14 communication reservation ). the initial value of the iicbsyn bit is set by using the stcenn bit (see 17.15 cautions ). the iicrsvn and stcenn bits can be written only when operation of i 2 c0n is disabled (iiccn.iicen bit = 0). after operation is enabled, iicfn can be read (n = 0 to 2). reset sets these registers to 00h.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 625 after reset: 00h r/w note address: iicf0 fffffd8ah, iicf1 fffffd9ah, iicf2 fffffdaah <7> <6> 5 4 3 2 <1> <0> iicfn stcfn iicbsyn 0 0 0 0 stcenn iicrsvn (n = 0 to 2) stcfn sttn bit clear 0 start condition issued 1 start condition cannot be issued, sttn bit cleared condition for clearing (stcfn bit = 0) condition for setting (stcfn bit = 1) ? cleared by iiccn.sttn bit = 1 ? when the iiccn.iicen bit = 0 ? after reset ? when start condition is not issued and sttn flag is cleared to 0 during communi cation reservation is disabled (iicrsvn bit = 1). iicbsyn i 2 c0n bus status 0 bus released status (default communi cation status when stcenn bit = 1) 1 bus communication status (default comm unication status when stcenn bit = 0) condition for clearing (iicbsyn bit = 0) condition for setting (iicbsyn bit = 1) ? when stop condition is detected ? when the iicen bit = 0 ? after reset ? when start condition is detected ? by setting the iicen bit when the stcenn bit = 0 stcenn initial start enable trigger 0 start conditions cannot be generated until a stop condition is detected following operation enable (iicen bit = 1). 1 start conditions can be generated even if a stop condition is not detected following operation enable (iicen bit = 1). condition for clearing (stcenn bit = 0) condition for setting (stcenn bit = 1) ? when start condition is detected ? after reset ? setting by instruction iicrsvn communication reserv ation function disable bit 0 communication reservation enabled 1 communication reservation disabled condition for clearing (iicrsvn bit = 0) condition for setting (iicrsvn bit = 1) ? clearing by instruction ? after reset ? setting by instruction note bits 6 and 7 are read-only bits. cautions 1. write the stcenn bit only wh en operation is stopped (iicen bit = 0). 2. when the stcenn bit = 1, the bus rel eased status (iicbsyn bit = 0) is recognized regardless of the actual bus st atus immediately after the i 2 cn bus operation is enabled. therefore, to issue the first start conditi on (sttn bit = 1), it is necessary to confirm that the bus has been re leased, so as to not disturb other communications. 3. write the iicrsvn bit only when operation is stopped (iicen bit = 0).
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 626 (4) iic clock select registers 0 to 2 (iiccl0 to iiccl2) the iiccl0 to iiccl2 registers se t the transfer clock for the i 2 c0n bus. these registers can be read or written in 8-bit or 1-bit units. however, the cldn and dadn bits are read-only. set the iiccln register when the iiccn.iicen bit = 0. the smcn, cln1, and cln0 bits are set by the comb ination of the iicxn.clxn bit and the ocksm.ocksthm, ocksm.ocksm1, and ocksm.ocksm0 bits (see 17.4 (6) i 2 c0n transfer clock setting method ) (n = 0 to 2, m = 0, 1). reset sets these registers to 00h. after reset: 00h r/w note address: iiccl0 fffffd84h, iiccl1 fffffd94h, iiccl2 fffffda4h 7 6 <5> <4> 3 2 1 0 iiccln 0 0 cldn dadn smcn dfcn cln1 cln0 (n = 0 to 2) cldn detection of scl0n pin level (valid only when iiccn.iicen bit = 1) 0 the scl0n pin was detected at low level. 1 the scl0n pin was detected at high level. condition for clearing (cldn bit = 0) condition for setting (cldn bit = 1) ? when the scl0n pin is at low level ? when the iicen bit = 0 (operation stop) ? after reset ? when the scl0n pin is at high level dadn detection of sda0n pin level (valid only when iicen bit = 1) 0 the sda0n pin was detected at low level. 1 the sda0n pin was detected at high level. condition for clearing (dadn bit = 0) condition for setting (dad0n bit = 1) ? when the sda0n pin is at low level ? when the iicen bit = 0 (operation stop) ? after reset ? when the sda0n pin is at high level smcn operation mode switching 0 operation in standard mode. 1 operation in high-speed mode. dfcn digital filter operation control 0 digital filter off. 1 digital filter on. the digital filter can be used only in high-speed mode. in high-speed mode, the transfer clock does not vary regardless of the dfcn bit setting (on/off). the digital filter is used to e liminate noise in high-speed mode. note bits 4 and 5 of iiccln are read-only bits. caution be sure to clear bits 7 and 6 of iiccln to 0. remark when the iiccn.iicen bit = 0, 0 is r ead when reading the cldn and dadn bits.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 627 (5) iic function expansion regist ers 0 to 2 (iicx0 to iicx2) the iicx0 to iicx2 registers set i 2 c0n function expansion (valid only in the high-speed mode). these registers can be read or wri tten in 8-bit or 1-bit units. setting of the clxn bit is performed in combinat ion with the iiccln.smcn, iiccln.cln1, and iiccln.cln0 bits and the ocksm.ocksthm, ocksm.ocksm1, and ocksm.ocksm0 bits (see 17.4 (6) i 2 c0n transfer clock setting method ) (m = 0, 1). set the iicxn register when the iiccn.iicen bit = 0. reset sets these registers to 00h. iicxn (n = 0 to 2) after reset: 00h r/w address: iicx0 fffffd85h, iicx1 fffffd95h, iicx2 fffffda5h 0 0 0 0 0 0 0 clxn < > (6) i 2 c0n transfer clock setting method the i 2 c0n transfer clock frequency (f scl ) is calculated using the following expression (n = 0 to 2). f scl = 1/(m t + t r + t f ) m = 12, 18, 24, 36, 44, 48, 54, 60, 66, 72, 86, 88, 90, 96, 120, 132, 172, 176, 198, 220, 258, 264, 330, 344, 430 (see table 17-2 clock settings ). t: 1/f xx t r : scl0n pin rise time t f : scl0n pin fall time for example, the i 2 c0n transfer clock frequency (f scl ) when f xx = 19.2 mhz, m = 198, t r = 200 ns, and t f = 50 ns is calculated using following expression. f scl = 1/(198 52 ns + 200 ns + 50 ns) ? 94.7 khz m t + t r + t f m/2 t t f t r m/2 t scl0n scl0n inversion scl0n inversion scl0n inversion the clock to be selected can be set by the combinat ion of the iiccln.smcn, iiccln.cln1, and iiccln.cln0 bits, the iicxn.clxn bit, and the ocksm.ocksthm, ocksm.ocksm1, and ocksm.ocksm0 bits (n = 0 to 2, m = 0, 1).
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 628 table 17-2. clock settings (1/2) iicx0 iiccl0 bit 0 bit 3 bit 1 bit 0 clx0 smc0 cl01 cl00 selection clock transfer clock settable main clock frequency (f xx ) range operating mode f xx (when ocks0 = 18h set) f xx /44 2.00 mhz f xx 4.19 mhz f xx /2 (when ocks0 = 10h set) f xx /88 4.00 mhz f xx 8.38 mhz f xx /3 (when ocks0 = 11h set) f xx /132 6.00 mhz f xx 12.57 mhz f xx /4 (when ocks0 = 12h set) f xx /176 8.00 mhz f xx 16.76 mhz 0 0 0 0 f xx /5 (when ocks0 = 13h set) f xx /220 10.00 mhz f xx 20.95 mhz note 1 f xx (when ocks0 = 18h set) f xx /86 4.19 mhz f xx 8.38 mhz f xx /2 (when ocks0 = 10h set) f xx /172 8.38 mhz f xx 16.76 mhz f xx /3 (when ocks0 = 11h set) f xx /258 12.57 mhz f xx 25.14 mhz note 1 f xx /4 (when ocks0 = 12h set) f xx /344 16.76 mhz f xx 32.00 mhz note 1 0 0 0 1 f xx /5 (when ocks0 = 13h set) f xx /430 20.95 mhz f xx 32.00 mhz note 2 0 0 1 0 f xx note 3 f xx /86 4.19 mhz f xx 8.38 mhz f xx (when ocks0 = 18h set) f xx /66 6.40 mhz f xx /2 (when ocks0 = 10h set) f xx /132 12.80 mhz f xx /3 (when ocks0 = 11h set) f xx /198 19.20 mhz f xx /4 (when ocks0 = 12h set) f xx /264 25.60 mhz note 2 0 0 1 1 f xx /5 (when ocks0 = 13h set) f xx /330 32.00 mhz note 2 standard mode (smc0 bit = 0) f xx (when ocks0 = 18h set) f xx /24 4.19 mhz f xx 8.38 mhz f xx /2 (when ocks0 = 10h set) f xx /48 8.00 mhz f xx 16.76 mhz f xx /3 (when ocks0 = 11h set) f xx /72 12.00 mhz f xx 25.14 mhz note 1 f xx /4 (when ocks0 = 12h set) f xx /96 16.00 mhz f xx 32.00 mhz note 1 0 1 0 f xx /5 (when ocks0 = 13h) f xx /120 20.00 mhz f xx 32.00 mhz note 2 0 1 1 0 f xx note 3 f xx /24 4.00 mhz f xx 8.38 mhz f xx (when ocks0 = 18h set) f xx /18 6.40 mhz f xx /2 (when ocks0 = 10h set) f xx /36 12.80 mhz f xx /3 (when ocks0 = 11h set) f xx /54 19.20 mhz f xx /4 (when ocks0 = 12h set) f xx /72 25.60 mhz note 2 0 1 1 1 f xx /5 (when ocks0 = 13h set) f xx /90 32.00 mhz note 2 f xx (when ocks0 = 18h set) f xx /12 4.00 mhz f xx 4.19 mhz f xx /2 (when ocks0 = 10h set) f xx /24 8.00 mhz f xx 8.38 mhz f xx /3 (when ocks0 = 11h set) f xx /36 12.00 mhz f xx 12.57 mhz f xx /4 (when ocks0 = 12h set) f xx /48 16.00 mhz f xx 16.67 mhz 1 1 0 f xx /5 (when ocks0 = 13h set) f xx /60 20.00 mhz f xx 20.95 mhz note 1 1 1 1 0 f xx note 3 f xx /12 4.00 mhz f xx 4.19 mhz high-speed mode (smc0 bit = 1) other than above setting prohibited ? ? ? notes 1. f xx > 20 mhz is settable only in the v850es/sj2-h. 2. settable only in the v850es/sj2-h 3. since the selection clock is f xx regardless of the value set to the oc ks0 register, clear the ocks0 register to 00h (i 2 c division clock stopped status). remark : don?t care
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 629 table 17-2. clock settings (2/2) iicxm iicclm bit 0 bit 3 bit 1 bit 0 clxm smcm clm1 clm0 selection clock transfer clock settable main clock frequency (f xx ) range operating mode f xx (when ocks1 = 18h set) f xx /44 2.00 mhz f xx 4.19 mhz f xx /2 (when ocks1 = 10h set) f xx /88 4.00 mhz f xx 8.38 mhz f xx /3 (when ocks1 = 11h set) f xx /132 6.00 mhz f xx 12.57 mhz f xx /4 (when ocks1 = 12h set) f xx /176 8.00 mhz f xx 16.76 mhz 0 0 0 0 f xx /5 (when ocks1 = 13h set) f xx /220 10.00 mhz f xx 20.95 mhz note 1 f xx (when ocks1 = 18h set) f xx /86 4.19 mhz f xx 8.38 mhz f xx /2 (when ocks1 = 10h set) f xx /172 8.38 mhz f xx 16.76 mhz f xx /3 (when ocks1 = 11h set) f xx /258 12.57 mhz f xx 25.14 mhz note 1 f xx /4 (when ocks1 = 12h set) f xx /344 16.76 mhz f xx 32.00 mhz note 1 0 0 0 1 f xx /5 (when ocks1 = 13h set) f xx /430 20.95 mhz f xx 32.00 mhz note 2 0 0 1 0 f xx note 3 f xx /86 4.19 mhz f xx 8.38 mhz f xx (when ocks1 = 18h set) f xx /66 6.40 mhz f xx /2 (when ocks1 = 10h set) f xx /132 12.80 mhz f xx /3 (when ocks1 = 11h set) f xx /198 19.20 mhz f xx /4 (when ocks1 = 12h set) f xx /264 25.60 mhz note 2 0 0 1 1 f xx /5 (when ocks1 = 13h set) f xx /330 32.00 mhz note 2 standard mode (smcm bit = 0) f xx (when ocks1 = 18h set) f xx /24 4.19 mhz f xx 8.38 mhz f xx /2 (when ocks1 = 10h set) f xx /48 8.00 mhz f xx 16.76 mhz f xx /3 (when ocks1 = 11h set) f xx /72 12.00 mhz f xx 25.14 mhz note 1 f xx /4 (when ocks1 = 12h set) f xx /96 16.00 mhz f xx 32.00 mhz note 1 0 1 0 f xx /5 (when ocks1 = 13h set) f xx /120 20.00 mhz f xx 32.00 mhz note 2 0 1 1 0 f xx note 3 f xx /24 4.00 mhz f xx 8.38 mhz f xx (when ocks1 = 18h set) f xx /18 6.40 mhz f xx /2 (when ocks1 = 10h set) f xx /36 12.80 mhz f xx /3 (when ocks1 = 11h set) f xx /54 19.20 mhz f xx /4 (when ocks1 = 12h set) f xx /72 25.60 mhz note 2 0 1 1 1 f xx /5 (when ocks1 = 13h set) f xx /90 32.00 mhz note 2 f xx (when ocks1 = 18h set) f xx /12 4.00 mhz f xx 4.19 mhz f xx /2 (when ocks1 = 10h set) f xx /24 8.00 mhz f xx 8.38 mhz f xx /3 (when ocks1 = 11h set) f xx /36 12.00 mhz f xx 12.57 mhz f xx /4 (when ocks1 = 12h set) f xx /48 16.00 mhz f xx 16.67 mhz 1 1 0 f xx /5 (when ocks1 = 13h set) f xx /60 20.00 mhz f xx 20.95 mhz note 1 1 1 1 0 f xx note 3 f xx /12 4.00 mhz f xx 4.19 mhz high-speed mode (smcm bit = 1) other than above setting prohibited ? ? ? notes 1. f xx > 20 mhz is settable only in the v850es/sj2-h. 2. settable only in the v850es/sj2-h 3. since the selection clock is f xx regardless of the value set to the oc ks1 register, clear the ocks1 register to 00h (i 2 c division clock stopped status). remarks 1. m = 1, 2 2. : don?t care
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 630 (7) iic division clock select re gisters 0, 1 (ocks0, ocks1) the ocks0 and ocks1 registers control the i 2 c0n division clock (n = 0 to 2). these registers control the i 2 c00 division clock via the ocks0 register and the i 2 c01 and i 2 c02 division clocks via the ocks1 register. these registers can be read or written in 8-bit units. reset sets these registers to 00h. 0 ocksm (m = 0, 1) 00 ocksenm ocksthm 0 ocksm1 ocksm0 after reset: 00h r/w address: ocks0 fffff340h, ocks1 fffff344h disable i 2 c division clock operation enable i 2 c division clock operation ocksenm 0 1 operation setting of i 2 c division clock ocksm1 0 0 1 1 0 other than above ocksm0 0 1 0 1 0 selection of i 2 c division clock f xx /2 f xx /3 f xx /4 f xx /5 f xx setting prohibited ocksthm 0 0 0 0 1 (8) iic shift registers 0 to 2 (iic0 to iic2) the iic0 to iic2 registers are used for serial transmi ssion/reception (shift operati ons) synchronized with the serial clock. these registers can be read or written in 8-bit units, but data should not be written to the iicn register during a data transfer. access (read/write) the iicn register only during the wait period. accessi ng this register in communication states other than the wa it period is prohibited. howe ver, for the master device, t he iicn register can be written once only after the transmission trigger bit (iiccn.sttn bit) has been set to 1. a wait state is released by wr iting the iicn register during the wait period, and data transfe r is started (n = 0 to 2). reset sets these registers to 00h. after reset: 00h r/w address: iic0 fffffd80h, iic1 fffffd90h, iic2 fffffda0h 7 6 5 4 3 2 1 0 iicn (n = 0 to 2)
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 631 (9) slave address registers 0 to 2 (sva0 to sva2) the sva0 to sva2 registers hold the i 2 c bus?s slave addresses. these registers can be read or written in 8-bit units, but bit 0 should be fixed to 0. however, rewriting these registers is prohibited when the iicsn.s tdn bit = 1 (start condition detection). reset sets these registers to 00h. after reset: 00h r/w address: sva0 fffffd83h, sva1 fffffd93h, sva2 fffffda3h 7 6 5 4 3 2 1 0 svan 0 (n = 0 to 2)
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 632 17.5 i 2 c bus mode functions 17.5.1 pin configuration the serial clock pin (scl0n) and serial data bus pin (sda0n) are configured as follows (n = 0 to 2). scl0n ................th is pin is used for serial clock input and output. this pin is an n-ch open-drain output for both ma ster and slave devices. input is schmitt input. sda0n ................th is pin is used for serial data input and output. this pin is an n-ch open-drain output for both ma ster and slave devices. input is schmitt input. since outputs from the serial clock line and the serial dat a bus line are n-ch open-drain outputs, an external pull-up resistor is required. figure 17-6. pin configuration diagram v dd scl0n sda0n scl0n sda0n v dd clock output master device (clock input) data output data input (clock output) clock input data output data input slave device
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 633 17.6 i 2 c bus definitions and control methods the following section describes the i 2 c bus?s serial data communication format and the signals used by the i 2 c bus. the transfer timing for the ?start condition?, ?address?, ?tr ansfer direction specification? , ?data?, and ?stop condition? generated on the i 2 c bus?s serial data bus is shown below. figure 17-7. i 2 c bus serial data transfer timing 1 to 7 8 9 1 to 8 9 1 to 8 9 scl0n sda0n r/w start condition address ack data data stop condition ack ack the master device generates the start condition, slave address, and stop condition. ack can be generated by either the master or slave device (normally, it is generated by the devic e that receives 8- bit data). the serial clock (scl0n) is continuous ly output by the master device. however, in t he slave device, the scl0n pin?s low-level period can be extended and a wa it state can be inserted (n = 0 to 2). 17.6.1 start condition a start condition is met when the scl0n pin is high level and the sda0n pin changes from high level to low level. the start condition for the scl0n and sda 0n pins is generated that the master device to the slave device when starting a serial transfer. the slave device can defect the start condition (n = 0 to 2). figure 17-8. start condition h scl0n sda0n a start condition is generated when the iiccn.sttn bit is set (1) after a stop condition has been detected (iicsn.spdn bit = 1). when a start condition is detec ted, the iicsn.stdn bit is set (1) (n = 0 to 2). caution when the iiccn.iicen bit of the v850es/sj2 and v850es/sj2-h is set to 1 while communications with other devices are in progress, the start condi tion may be detected depending on the status of the communication line. be sure to set th e iiccn.iicen bit to 1 when the scl0n and sda0n lines are high level.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 634 17.6.2 addresses the 7 bits of data that follow the st art condition are defined as an address. an address is a 7-bit data segment that is output in order to select one of t he slave devices that are connected to the master device via the bus lines. therefore, each slave device connect ed via the bus lines must have a unique address. the slave devices include hardware that detects the start condition and chec ks whether or not the 7-bit address data matches the data values stored in t he svan register. if the address data matc hes the values of the svan register, the slave device is selected and communicates with the ma ster device until the master device generates a start condition or stop condition (n = 0 to 2). figure 17-9. address address scl0n 1 sda0n intiicn note 23456789 ad6 ad5 ad4 ad3 ad2 ad1 ad0 r/w note the interrupt request signal (int iicn) is generated if a local addre ss or extension code is received during slave device operation. remark n = 0 to 2 the slave address and the eighth bit, which specif ies the transfer direction as described in 17.6.3 transfer direction specification below, are written together to iic shift regi ster n (iicn) and then out put. received addresses are written to the iicn register (n = 0 to 2). the slave address is assigned to the hi gher 7 bits of the iicn register.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 635 17.6.3 transfer dir ection specification in addition to the 7-bit address data, the master device sends 1 bit that specifies the transfer direction. when this transfer direction specification bit has a value of 0, it indicates that the master device is transmitting data to a slave device. when the transfer direction specification bit has a value of 1, it indicate s that the master device is receiving data from a slave device. figure 17-10. transfer direction specification scl0n 1 sda0n intiicn 23456789 ad6 ad5 ad4 ad3 ad2 ad1 ad0 r/w transfer direction specification note note the intiicn signal is generated if a local address or extension code is re ceived during slave device operation. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 636 17.6.4 ack ack is used to confirm the serial data stat us of the transmitting and receiving devices. the receiving device returns ack for every 8 bits of data it receives. the transmitting device normally receives ack after transmi tting 8 bits of data. when ack is returned from the receiving device, the reception is j udged as normal and processing continues. t he detection of ack is confirmed with the iicsn.ackdn bit. when the master device is the receivi ng device, after receiving the final dat a, it does not return ack and generates the stop condition. when the slave dev ice is the receiving device and does not return ack, the master device generates either a stop condition or a rest art condition, and then stops the current transmission. failure to return ack may be caused by the following factors. (a) reception was not performed normally. (b) the final data was received. (c) the receiving device (slave) does not exist for the specified address. when the receiving device sets the sda0n line to low level during the ninth clo ck, ack is generated (normal reception). when the iiccn.acken bit is set to 1, automatic ac k generation is enabled. trans mission of the eighth bit following the 7 address data bits causes the iicsn.trcn bit to be set. normally, set the acken bit to 1 for reception (trcn bit = 0). when the slave device is receiving (when trcn bit = 0), if the slave device cannot rece ive data, clear the acken bit to 0 to indicate to the master that no more data can be received. similarly, when the master device is receiving (when trcn bit = 0) and the subsequent data is not needed, clear the acken bit to 0 to prevent ack from being generated. th is notifies the slave device (transmitting device) of the end of the data transmissi on (transmission stopped). figure 17-11. ack scl0n 1 sda0n 23456789 ad6 ad5 ad4 ad3 ad2 ad1 ad0 r/w ack remark n = 0 to 2 when the local address is received, ack is automatically generated regardless of the value of the acken bit. no ack is generated if the received addre ss is not a local address (nack). when receiving the extension code, set the acken bit to 1 in advance to generate ack. the ack generation method during data rec eption is based on the wait timing setti ng, as described by the following. ? when 8-clock wait is selected (iiccn.wtimn bit = 0): ack is generated at the falling edge of t he scl0n pin?s eighth clock if the acken bit is set to 1 before the wait state cancellation. ? when 9-clock wait is selected (iiccn.wtimn bit = 1): ack is generated if the acken bit is set to 1 in advance. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 637 17.6.5 stop condition when the scl0n pin is high level, changing the sda0n pin fr om low level to high level generates a stop condition (n = 0 to 2). a stop condition is generated when the ma ster device outputs to the slave device when serial transfer has been completed. when used as the slave devi ce, the start condition can be detected. figure 17-12. stop condition h scl0n sda0n remark n = 0 to 2 a stop condition is generated when the ii ccn.sptn bit is set to 1. when the stop condition is detected, the iicsn.spdn bit is set to 1 and the interrupt request signal (i ntiicn) is generated when the ii ccn.spien bit is set to 1 (n = 0 to 2).
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 638 17.6.6 wait state a wait state is used to notify the comm unication partner that a device (master or slave) is preparing to transmit or receive data (i.e., is in a wait state). setting the scl0n pin to low level notifies the communication partner of the wait state. when the wait state has been canceled for both the master and slave devices, the next data transfer can begin (n = 0 to 2). figure 17-13. wait state (1/2) (a) when master device has a nine-clock wa it and slave device has an eight-clock wait (master: transmission, slave: recep tion, and iiccn.acken bit = 1) scl0n 6 sda0n 78 9 123 scl0n iicn 6 h 78 123 d2 d1 d0 ack d7 d6 d5 9 iicn scl0n acken master master returns to high impedance but slave is in wait state (low level). wait after output of ninth clock. iicn data write (cancel wait state) slave wait after output of eighth clock. ffh is written to iicn register or iiccn.wreln bit is set to 1. transfer lines wait state from slave wait state from master remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 639 figure 17-13. wait state (2/2) (b) when master and slave d evices both have a nine-clock wait (master: transmission, slave: reception, and acken bit = 1) scl0n 6 sda0n 789 123 scl0n iicn 6 h 78 1 23 d2 d1 d0 ack d7 d6 d5 9 iicn scl0n acken master master and slave both wait after output of ninth clock. iicn data write (cancel wait state) slave ffh is written to iicn register or wreln bit is set to 1. generate according to previously set acken bit value transfer lines wait state from master/ slave wait state from slave remark n = 0 to 2 a wait state is automatically generated after generation of the start condition. a wait state is also automatically generated depending on the setting of the iiccn.wtimn bit (n = 0 to 2). normally, when the wreln bit is set to 1 or when ffh is wr itten to the iicn register on the receiving side, the wait state is canceled and the transmitting side writes data to the iicn regist er to cancel the wait state. the master device can also cancel the wait state via either of the following methods. ? by setting the iiccn.sttn bit to 1 ? by setting the iiccn.sptn bit to 1
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 640 17.6.7 wait state cancellation method in the case of i 2 c0n, wait state can be canceled normally in the following ways (n = 0 to 2). ? by writing data to the iicn register ? by setting the iiccn.wreln bit to 1 (wait state cancellation) ? by setting the iiccn.sttn bit to 1 (start condition generation) note ? by setting the iiccn.sptn bit to 1 (stop condition generation) note note master only if any of these wait state canc ellation actions is performed, i 2 c0n will cancel wait state and restart communication. when canceling wait state and s ending data (including address), writ e data to the iicn register. to receive data after canceling wait state, or to complete data transmission, set the wreln bit to 1. to generate a restart condition after canceli ng wait state, set the sttn bit to 1. to generate a stop condition after canceling wait state, set the sptn bit to 1. execute cancellation only once for each wait state. for example, if data is written to t he iicn register following wait state canc ellation by setting the wreln bit to 1, conflict between the sdan line change timing and iicn register write timing may resu lt in the data output to the sdan line may be incorrect. even in other operations, if communication is stopped halfway, clearing the iiccn.iicen bit to 0 will stop communication, enabling wait state to be cancelled. if the i 2 c bus dead-locks due to noise, etc., setting the iiccn.lre ln bit to 1 causes the communication operation to be exited, enabling wait st ate to be cancelled.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 641 17.7 i 2 c interrupt request signals (intiicn) the following shows the value of the iic sn register at the intiicn interr upt request signal generation timing and at the intiicn signal timing. remarks 1. st: start condition ad6 to ad0: address r/w: transfer direction specification ack: acknowledge d7 to d0: data sp: stop condition 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 642 17.7.1 master device operation (1) start ~ address ~ data ~ data ~ stop (normal transmission/reception) <1> when iiccn.wtimn bit = 0 iiccn.sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x000b s 3: iicsn register = 1000x000b (wtimn bit = 1 note ) s 4: iicsn register = 1000xx00b 5: iicsn register = 00000001b note set the wtimn bit (1) and change the timing of generating the inte rrupt request signal (intiicn) to generate the stop condition. remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x100b s 3: iicsn register = 1000xx00b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 643 (2) start ~ address ~ data ~ star t ~ address ~ data ~ stop (restart) <1> when wtimn bit = 0 sttn bit = 1 sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 s 5 s 6 7 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x000b (wtimn bit = 1 note 1 ) s 3: iicsn register = 1000xx00b (wtimn bit = 0 note 2 ) s 4: iicsn register = 1000x110b s 5: iicsn register = 1000x000b (wtimn bit = 1 note 3 ) s 6: iicsn register = 1000xx00b 7: iicsn register = 00000001b notes 1. set the wtimn bit (1) and change the timing of generating the interrupt request signal (intiicn) to generate the start condition. 2. clear the wtimn bit (0) to restore the original setting. 3. set the wtimn bit (1) and change the timing of generating the interrupt request signal (intiicn) to generate the stop condition. remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 sttn bit = 1 sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000xx00b s 3: iicsn register = 1000x110b s 4: iicsn register = 1000xx00b 5: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 644 (3) start ~ code ~ data ~ data ~ stop (extension code transmission) <1> when wtimn bit = 0 sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 1010x110b s 2: iicsn register = 1010x000b s 3: iicsn register = 1010x000b (wtimn bit = 1 note ) s 4: iicsn register = 1010xx00b 5: iicsn register = 00000001b note set the wtimn bit (1) and change the timing of generating the inte rrupt request signal (intiicn) to generate the stop condition. remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 1010x110b s 2: iicsn register = 1010x100b s 3: iicsn register = 1010xx00b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 645 17.7.2 slave device operation (when r eceiving slave address (address match)) (1) start ~ address ~ data ~ data ~ stop <1> when iiccn.wtimn bit = 0 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001x000b s 3: iicsn register = 0001x000b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when iiccn.spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001x100b s 3: iicsn register = 0001xx00b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 646 (2) start ~ address ~ data ~ start ~ address ~ data ~ stop <1> when wtimn bit = 0 (after restart, address match) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001x000b s 3: iicsn register = 0001x110b s 4: iicsn register = 0001x000b 5: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 (after restart, address match) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001xx00b s 3: iicsn register = 0001x110b s 4: iicsn register = 0001xx00b 5: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 647 (3) start ~ address ~ data ~ start ~ code ~ data ~ stop <1> when wtimn bit = 0 (after restart, a ddress mismatch (extension code reception)) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001x000b s 3: iicsn register = 0010x010b s 4: iicsn register = 0010x000b 5: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 (after restart, a ddress mismatch (extension code reception)) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 s 5 6 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001xx00b s 3: iicsn register = 0010x010b s 4: iicsn register = 0010x110b s 5: iicsn register = 0010xx00b 6: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 648 (4) start ~ address ~ data ~ start ~ address ~ data ~ stop <1> when wtimn bit = 0 (after restart, address mismatch (= not extension code)) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001x000b s 3: iicsn register = 00000110b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 (after restart, address mismatch (= not extension code)) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001xx00b s 3: iicsn register = 00000110b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 649 17.7.3 slave device operation (w hen receiving extension code) the device always participates in communica tion when it receives the extension code. (1) start ~ code ~ data ~ data ~ stop <1> when iiccn.wtimn bit = 0 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x000b s 3: iicsn register = 0010x000b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when iiccn.spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x110b s 3: iicsn register = 0010x100b s 4: iicsn register = 0010xx00b 5: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 650 (2) start ~ code ~ data ~ start ~ address ~ data ~ stop <1> when wtimn bit = 0 (after restart, address match) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x000b s 3: iicsn register = 0001x110b s 4: iicsn register = 0001x000b 5: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 (after restart, address match) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 s 5 6 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x110b s 3: iicsn register = 0010xx00b s 4: iicsn register = 0001x110b s 5: iicsn register = 0001xx00b 6: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 651 (3) start ~ code ~ data ~ start ~ code ~ data ~ stop <1> when wtimn bit = 0 (after restart, extension code reception) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x000b s 3: iicsn register = 0010x010b s 4: iicsn register = 0010x000b 5: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 (after restart, extension code reception) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 s 5 s 6 7 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x110b s 3: iicsn register = 0010xx00b s 4: iicsn register = 0010x010b s 5: iicsn register = 0010x110b s 6: iicsn register = 0010xx00b 7: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 652 (4) start ~ code ~ data ~ start ~ address ~ data ~ stop <1> when wtimn bit = 0 (after restart, address mismatch (= not extension code)) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x000b s 3: iicsn register = 00000110b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 (after restart, address mismatch (= not extension code)) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x110b s 3: iicsn register = 0010xx00b s 4: iicsn register = 00000110b 5: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 653 17.7.4 operation without communication (1) start ~ code ~ data ~ data ~ stop st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp 1 1: iicsn register = 00000001b remarks 1. : generated only when spien bit = 1 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 654 17.7.5 arbitration loss operation (opera tion as slave after arbitration loss) when the device is used as t he master in a multi-master system, read the iicsn.mstsn bit to check the arbitration result each time the intiic n interrupt has been generated. (1) when arbitration loss occurs dur ing transmission of slave address data <1> when iiccn.wtimn bit = 0 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 0101x110b s 2: iicsn register = 0001x000b s 3: iicsn register = 0001x000b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when iiccn.spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 0101x110b s 2: iicsn register = 0001x100b s 3: iicsn register = 0001xx00b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 655 (2) when arbitration loss occurs dur ing transmission of extension code <1> when wtimn bit = 0 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 0110x010b s 2: iicsn register = 0010x000b s 3: iicsn register = 0010x000b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 0110x010b s 2: iicsn register = 0010x110b s 3: iicsn register = 0010x100b s 4: iicsn register = 0010xx00b 5: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 656 17.7.6 operation when arbitrat ion loss occurs (no communicat ion after arbitration loss) when the device is used as t he master in a multi-master system, read the iicsn.mstsn bit to check the arbitration result each time the intiic n interrupt has been generated. (1) when arbitration loss occurs dur ing transmission of slave address data st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 2 s 1: iicsn register = 01000110b 2: iicsn register = 00000001b remarks 1. s : always generated : generated only when iiccn.spien bit = 1 2. n = 0 to 2 (2) when arbitration loss occurs during transmission of extension code st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 2 s 1: iicsn register = 0110x010b iiccn.lreln bit is set to 1 by software 2: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 657 (3) when arbitration loss o ccurs during data transfer <1> when iiccn.wtimn bit = 0 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 3 s 1: iicsn register = 10001110b s 2: iicsn register = 01000000b 3: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 2. n = 0 to 2 <2> when wtimn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 3 s 1: iicsn register = 10001110b s 2: iicsn register = 01000100b 3: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 658 (4) when arbitration loss occurs due to restart condition dur ing data transfer <1> not extension code (example: address mismatch) st ad6 to ad0 r/w ack d7 to dn st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 3 s 1: iicsn register = 1000x110b s 2: iicsn register = 01000110b 3: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. dn = d6 to d0 n = 0 to 2 <2> extension code st ad6 to ad0 r/w ack d7 to dn st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 3 s 1: iicsn register = 1000x110b s 2: iicsn register = 0110x010b iiccn.lreln bit is set to 1 by software 3: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. dn = d6 to d0 n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 659 (5) when arbitration loss occurs due to stop condition during data transfer st ad6 to ad0 r/w ack d7 to dn sp s 1 2 s 1: iicsn register = 1000x110b 2: iicsn register = 01000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. dn = d6 to d0 n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 660 (6) when arbitration loss occurs due to low level of sda0n pin when attempting to generate a restart condition <1> when wtimn bit = 0 iiccn.sttn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x000b (wtimn bit = 1) s 3: iicsn register = 1000x100b (wtimn bit = 0) s 4: iicsn register = 01000000b 5: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 iiccn.sttn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x100b s 3: iicsn register = 01000100b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 661 (7) when arbitration loss occurs due to a stop condi tion when attempting to ge nerate a restart condition <1> when wtimn bit = 0 sttn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x000b (wtimn bit = 1) s 3: iicsn register = 1000xx00b 4: iicsn register = 01000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 sttn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 3 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000xx00b 3: iicsn register = 01000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 662 (8) when arbitration loss occurs due to low level of sda0n pin wh en attempting to generate a stop condition <1> when wtimn bit = 0 iiccn.sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 s 4 5 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x000b (wtimn bit = 1) s 3: iicsn register = 1000x100b (wtimn bit = 0) s 4: iicsn register = 01000100b 5: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2 <2> when wtimn bit = 1 iiccn.sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 4 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x100b s 3: iicsn register = 01000100b 4: iicsn register = 00000001b remarks 1. s : always generated : generated only when spien bit = 1 x: don?t care 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 663 17.8 interrupt request signal (intiicn) generation timing and wait control the setting of the iiccn.wtimn bit determines the timi ng by which the intiicn r egister is generated and the corresponding wait control, as shown below (n = 0 to 2). table 17-3. intiicn genera tion timing and wait control during slave device operation du ring master device operation wtimn bit address data reception data transmission address data reception data transmission 0 9 notes 1, 2 8 note 2 8 note 2 9 8 8 1 9 notes 1, 2 9 note 2 9 note 2 9 9 9 notes 1. the slave device?s intiicn signal and wait period o ccur at the falling edge of the ninth clock only when there is a match with the addre ss set to the svan register. at this point, the ack is generated regardless of the value set to the iiccn.acken bit. for a slave device that has received an extensi on code, the intiicn signal occurs at the falling edge of the eighth clock. when the address does not match after restart, the intiicn signal is generated at the falling edge of the ninth clock, but no wait occurs. 2. if the received address does not ma tch the contents of the svan regi ster and an extension code is not received, neither the intiicn signal nor a wait occurs. remarks 1. the numbers in the table indicate the number of the serial clock?s clock signals. interrupt requests and wait control are both synchronized wit h the falling edge of these clock signals. 2. n = 0 to 2 (1) during address transmission/reception ? slave device operation: interrupt and wait ti ming are determined regardless of the wtimn bit. ? master device operation: interrupt and wait timing occur at the falling edge of the ninth clock regardless of the wtimn bit. (2) during data reception ? master/slave device operation: interrupt and wait timing is determined according to the wtimn bit. (3) during data transmission ? master/slave device operation: interrupt and wait timing is determined according to the wtimn bit.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 664 (4) wait cancellation method the four wait cancellation methods are as follows. ? by writing data to the iicn register ? by setting the iiccn.wreln bit to 1 (wait cancellation) ? by setting the iiccn.sttn bit to 1 (start condition generation) note ? by setting the iiccn.sptn bi t to 1 (stop condition generation) note note master only when an 8-clock wait has been selected (wtimn bit = 0), whether or not the ack has been generated must be determined prior to wait cancellation. remark n = 0 to 2 (5) stop condition detection the intiicn signal is generated w hen a stop condition is detected. remark n = 0 to 2 17.9 address match detection method in i 2 c bus mode, the master dev ice can select a particular slave devic e by transmitting the corresponding slave address. address match detection is performed aut omatically by hardware. the int iicn signal occurs when a local address has been set to the svan register and when the address set to the svan register matches the slave address sent by the master device, or when an extensi on code has been received (n = 0 to 2). 17.10 error detection in i 2 c bus mode, the status of the serial data bus pin (sda0n) during data transmission is captured by the iicn register of the transmitting device, so the data of the iicn regi ster prior to transmissi on can be compared with the transmitted iicn data to enable detection of transmission erro rs. a transmission error is judged as having occurred when the compared data values do not match (n = 0 to 2).
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 665 17.11 extension code (1) when the higher 4 bits of the receive address are either 0000 or 1111, the ext ension code flag (iicsn.excn bit) is set for extension code reception and an interrupt request signal (intiicn) is issued at the falling edge of the eighth clock (n = 0 to 2). the local address stored in the svan register is not affected. (2) if 11110xx0 is set to the svan register by a 10- bit address transfer and 11110xx0 is transferred from the master device, the results are as fo llows. note that the intiicn signal occurs at the falling edge of the eighth clock (n = 0 to 2) ? higher four bits of data match: excn bit = 1 ? seven bits of data match: iicsn.coin bit = 1 (3) since the processing after the interrupt request signal occurs differs according to the data that follows the extension code, such processi ng is performed by software. the device participates in communication when it receives the extension code while it is operating as a slave, even if the address does not match. for example, when operation as a sl ave is not desired after the ext ension code is received, set the iiccn.lreln bit to 1 and the cpu will enter the next communication wait state. table 17-4. extension code bit definitions slave address r/w bit description 0000 000 0 general call address 0000 000 1 start byte 0000 001 x cbus address 0000 010 x address that is reserved for different bus format 1111 0xx x 10-bit slave address specification
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 666 17.12 arbitration when several master devices simultaneous ly generate a start condition (when the iiccn.sttn bit is set to 1 before the iicsn.stdn bit is set to 1), communication between the ma ster devices is performed wh ile the number of clocks is adjusted until the data differs. this kind of oper ation is called arbitration (n = 0 to 2). when one of the master devices loses in arbitration, an arbitration loss flag ( iicsn.aldn bit) is set to 1 via the timing by which the arbitration loss occurred, and the scl0n and sda0n lines are both set to high impedance, which releases the bus (n = 0 to 2). arbitration loss is detected based on t he timing of the next interrupt request signal (intiicn) (the eighth or ninth clock, when a stop condition is det ected, etc.) and the setting of the aldn bit to 1, which is made by software (n = 0 to 2). for details of interrupt request timing, see 17.7 i 2 c interrupt request signals (intiicn) . figure 17-14. arbitration timing example master 1 master 2 transfer lines scl0n sda0n scl0n sda0n scl0n sda0n master 1 loses arbitration hi-z hi-z remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 667 table 17-5. status during arbitration a nd interrupt request si gnal generation timing status during arbitration inte rrupt request generation timing transmitting address transmission read/write data after address transmission transmitting extension code read/write data after extension code transmission transmitting data ack transfer period after data reception when restart condition is det ected during data transfer at falling edge of eighth or ninth clock following byte transfer note 1 when stop condition is detected duri ng data transfer when stop condition is generated (when iiccn.spien bit = 1) note 2 when sda0n pin is low level while attempting to generate restart condition at falling edge of eighth or ninth clock following byte transfer note 1 when stop condition is detected while attempting to generate restart condition when stop condition is generated (when iiccn.spien bit = 1) note 2 when dsa0n pin is low level while attempting to generate stop condition when scl0n pin is low level while attempting to generate restart condition at falling edge of eighth or ninth clock following byte transfer note 1 notes 1. when the iiccn.wtimn bit = 1, an intiicn signal o ccurs at the falling edge of the ninth clock. when the wtimn bit = 0 and the extension code?s slave address is received, an intiicn signal occurs at the falling edge of the eighth clock (n = 0 to 2). 2. when there is a possibility that arbitration will occur, set the spien bit to 1 for master device operation (n = 0 to 2). 17.13 wakeup function the i 2 c bus slave function is a function that generates an interrupt request si gnal (intiicn) when a local address and extension code have been received. th is function makes processing more efficient by preventing unnecessary the intiicn signal from occurring when addresses do not match. when a start condition is detected, wa keup standby mode is set. this wak eup standby mode is in effect while addresses are transmitted due to the possi bility that an arbitration loss may change the master device (which has generated a start condition) to a slave device. however, when a stop condition is detect ed, the iiccn.spien bit is set regardl ess of the wakeup function, and this determines whether intiicn signal is enabled or disabled (n = 0 to 2).
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 668 17.14 communication reservation 17.14.1 when communication reservation functi on is enabled (iicfn.iicrsvn bit = 0) to start master device communications when not current ly using the bus, a communication reservation can be made to enable transmission of a start condition when the bus is released. there are two modes in which the bus is not used. ? when arbitration results in neit her master nor slave operation ? when an extension code is received and slave operation is disabled (ack is not returned and the bus was released when the iiccn.lreln bit was set to 1) (n = 0 to 2). if the iiccn.sttn bit is set to 1 while the bus is not used, a start condition is aut omatically generated and a wait status is set after the bus is releas ed (after a stop condition is detected). the device automatically starts comm unication as the master when an address is written to the iicn register after the iiccn.spien bit has been set (1) and release of t he bus has been detected (i.e., the stop condition has been detected) by generation of an in terrupt request (intiicn). data written to the iicn register is invalid before the stop condition is detected. when the sttn bit has been set to 1, the operation mode (a s start condition or as communication reservation) is determined according to the bus status (n = 0 to 2). if the bus has been re leased .............................................a start condition is generated if the bus has not been released (standby mode)..............comm unication reservation to detect which operation mode has been det ermined for the sttn bit, set the sttn bit to 1, wait for the wait period, then check the iicsn.mstsn bit (n = 0 to 2). the wait periods, which should be set via software, are list ed in table 17-6. these wait periods can be set by the iiccln.smcn, iiccln.cln1, and iiccln.cln0 bits and the iicxn.clxn bit (n = 0 to 2).
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 669 table 17-6. wait periods clock selection clxn smcn cln1 cln0 wait period f xx (when ocksm = 18h set) 0 0 0 0 26 clocks f xx /2 (when ocksm = 10h set) 0 0 0 0 52 clocks f xx /3 (when ocksm = 11h set) 0 0 0 0 78 clocks f xx /4 (when ocksm = 12h set) 0 0 0 0 104 clocks f xx /5 (when ocksm = 13h set) 0 0 0 0 130 clocks f xx (when ocksm = 18h set) 0 0 0 1 47 clocks f xx /2 (when ocksm = 10h set) 0 0 0 1 94 clocks f xx /3 (when ocksm = 11h set) 0 0 0 1 141 clocks f xx /4 (when ocksm = 12h set) 0 0 0 1 188 clocks f xx /5 (when ocksm = 13h set) 0 0 0 1 235 clocks note f xx 0 0 1 0 47 clocks f xx (when ocksm = 18h set) 0 1 0 16 clocks f xx /2 (when ocksm = 10h set) 0 1 0 32 clocks f xx /3 (when ocksm = 11h set) 0 1 0 48 clocks f xx /4 (when ocksm = 12h set) 0 1 0 64 clocks f xx /5 (when ocksm = 13h set) 0 1 0 80 clocks note f xx 0 1 1 0 16 clocks f xx (when ocksm = 18h set) 1 1 0 10 clocks f xx /2 (when ocksm = 10h set) 1 1 0 20 clocks f xx /3 (when ocksm = 11h set) 1 1 0 30 clocks f xx /4 (when ocksm = 12h set) 1 1 0 40 clocks f xx /5 (when ocksm = 13h set) 1 1 0 50 clocks note f xx 1 1 1 0 10 clocks note v850es/sj2-h only remarks 1. n = 0 to 2 m = 0, 1 2. = don?t care the communication reservation timing is shown below.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 670 figure 17-15. communication reservation timing 2 1 3456 2 13456 789 scl0n sda0n program processing hardware processing write to iicn set spdn and intiicn sttn =1 communication reservation set stdn generated by master with bus access iicn: iiccn shift register n sttn: bit 1 of iic control register n (iiccn) stdn: bit 1 of iic status register n (iicsn) spdn: bit 0 of iic status register n (iicsn) remark n = 0 to 2 communication reservations are accepted via the following timing. after the iicsn.stdn bit is set to 1, a communication reservation can be made by setting the iiccn.s ttn bit to 1 before a stop condition is detected (n = 0 to 2). figure 17-16. timing for accep ting communication reservations scl0n sda0n stdn spdn standby mode remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 671 the communication reservation flowchart is illustrated below. figure 17-17. communication reservation flowchart di set1 sttn define communication reservation wait cancel communication reservation no yes iicn register xxh ei mstsn bit = 0? (communication reservation) note (generate start condition) sets sttn bit (communication reservation). secures wait period set by software (see table 17-6 ). confirmation of communication reservation clears user flag. iicn register write operation defines that communication reservation is in effect (defines and sets user flag to any part of ram). note the communication reservation oper ation executes a write to the iicn register when a stop condition interrupt request occurs. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 672 17.14.2 when communication reservation functi on is disabled (iicfn.iicrsvn bit = 1) when the iiccn.sttn bit is set when the bus is not us ed in a communication during bus communication, this request is rejected and a start condition is not generated. there are two modes in which the bus is not used ? when arbitration results in nei ther master nor slave operation ? when an extension code is received and slave operation is disabled (ack is not returned and the bus was released when the iiccn.lreln bit was set to 1) (n = 0 to 2). to confirm whether the start conditi on was generated or request was rejected, check the iicfn.stcfn flag. the time shown in table 17-7 is required until the stcfn flag is set after setting the sttn bit to 1. therefore, secure the time by software. table 17-7. wait periods selection clock ocksenm ocksthm ocksm1 ocksm0 cln1 cln0 wait period f xx /2 (when setting ocksm = 10h) 1 0 0 0 0 x 6 clocks f xx /3 (when setting ocksm = 11h) 1 0 0 1 0 x 9 clocks f xx /4 (when setting ocksm = 12h) 1 0 1 0 0 x 12 clocks f xx /5 (when setting ocksm = 13h) 1 0 1 1 0 x 15 clocks f xx (when setting ocksm = 18h) 1 1 0 0 0 x 3 clocks f xx 0 0 0 0 1 0 3 clocks f xx /2 (when setting ocksm = 10h) 1 0 0 0 1 1 6 clocks f xx /3 (when setting ocksm = 11h) 1 0 0 1 1 1 9 clocks f xx /4 (when setting ocksm = 12h) 1 0 1 0 1 1 12 clocks f xx /5 (when setting ocksm = 13h) 1 0 1 1 1 1 15 clocks f xx (when setting ocksm = 18h) 1 1 0 0 1 1 3 clocks remarks 1. : don?t care 2. n = 0 to 2 m = 0, 1 3. clock = f xx (main clock frequency)
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 673 17.15 cautions (1) when iicfn.stcenn bit = 0 immediately after the i 2 c0n operation is enabled, the bus communica tion status (iicfn.iicbsyn bit = 1) is recognized regardless of the actual bus status. to execute master comm unication in the status where a stop condition has not been detect ed, generate a stop condition and then releas e the bus before st arting the master communication. use the following sequence for generating a stop condition. <1> set the iiccln register. <2> set the iiccn.iicen bit. <3> set the iiccn.sptn bit. (2) when iicfn.stcenn bit = 1 immediately after i 2 c0n operation is enabled, the bus released st atus (iicbsyn bit = 0) is recognized regardless of the actual bus status. to generate the first start condition (iiccn.sttn bit = 1), it is necessary to confirm that the bus has been released, so as to not disturb other communications. (3) when the iiccn.iicen bit of the v850es/sj2 and v850es/sj2-h is set to 1 while communications with other devices are in progress, the start condition may be detected depending on the st atus of the communication line. be sure to set the iiccn.iic en bit to 1 when the scl0n and sda0n lines are high level. (4) determine the operation clock frequency by the ii ccln, iicxn, and ocksm registers before enabling the operation (iiccn.iicen bit = 1). to change the operation clock frequency, clear the iiccn.iicen bit to 0 once. (5) after the iiccn.sttn and iiccn.sptn bits have been set to 1, they must not be re -set without being cleared to 0 first. (6) if transmission has been reserved, set the iiccn.spien bit to 1 so that an interrupt request is generated by the detection of a stop condition. afte r an interrupt request has been generated, the wait status will be released by writing communication data to i 2 cn, then transferring will begin. if an inte rrupt is not generat ed by the detection of a stop condition, transmission will hal t in the wait status because an in terrupt request was not generated. however, it is not necessary to set the spien bit to 1 for the software to detect the iicsn.mstsn bit. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 674 17.16 communication operations the following shows three operati on procedures with the flowchart. (1) master operation in single master system the flowchart when using the v850es/ sj2 or v850es/sj2-h as the master in a single master system is shown below. this flowchart is broadly divided into the initial setti ngs and communication processi ng. execute the initial settings at startup. if communica tion with the slave is required, pr epare the communication and then execute communication processing. (2) master operation in multimaster system in the i 2 c0n bus multimaster system, whether the bus is released or used cannot be judged by the i 2 c bus specifications when the bus takes part in a communicati on. here, when data and clock are at a high level for a certain period (1 frame), the v850 es/sj2 or v850es/sj2-h takes part in a communication with bus released state. this flowchart is broadly divided into the initial setti ngs, communication waiting, and communication processing. the processing when the v850es/sj2 or v850es/sj2-h looses in arbitration and is specified as the slave is omitted here, and only the processing as the master is shown. execute the initial settings at startup to take part in a communication. then, wait for the communicati on request as the master or wait for the specification as the slave. the actual communi cation is performed in the communica tion processing, and it supports the transmission/reception with the slave and the arbitration wit h other masters. (3) slave operation an example of when the v850es/sj2 or v850 es/sj2-h is used as the slave of the i 2 c0n bus is shown below. when used as the slave, operation is st arted by an interrupt. execute the in itial settings at st artup, then wait for the intiicn interrupt occurrence (communication waiting). when the intiicn interrupt occurs, the communication status is judged and its result is pa ssed as a flag over to the main processing. by checking the flags, necessary communication processing is performed. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 675 17.16.1 master operation in single master system figure 17-18. master operati on in single master system iicxn 0xh iiccln xxh iicfn 0xh set stcenn, iicrsvn = 0 iiccn xxh acken = wtimn = spien = 1 iicen = 1 sptn = 1 svan xxh iicn write iicn write sptn = 1 wreln = 1 start end acken = 0 wtimn = wreln = 1 no no yes no no no yes yes yes yes stcenn = 1? acken = 1 wtimn = 0 trcn = 1? ackdn = 1? ackdn = 1? no yes no yes yes no intiicn interrupt occurred? yes no intiicn interrupt occurred? yes no yes no yes no sttn = 1 set ports initialize i 2 c bus note iic read intiic interrupt occurred? transfer completed? transfer completed? restarted? ackd bit = 1? see table 4-19 using port pin as alternate-function pin to set the i 2 c mode before this function is used. transfer clock selection local address setting start condition setting communication start preparation (start condition generation) communication start (address, transfer direction specification) waiting for ack detection waiting for data transmission transmission start communication processing initial settings reception start waiting for data reception intiic interrupt occurred? waiting for ack detection communication start preparation (stop condition generation) waiting for stop condition detection intiic interrupt occurred? note release the i 2 c0n bus (scl0n, sda0n pins = high level) in conformity with the s pecifications of the product in communication. for example, when the eeprom tm outputs a low level to the sda0n pi n, set the scl0n pin to the output port and output clock pulses from t hat output port until when the sda0n pin is constantly high level. remarks 1. for the transmission and reception formats, confo rm to the specificati ons of the product in communication. 2. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 676 17.16.2 master operation in multimaster system figure 17-19. master operation in multimaster system (1/3) iicxn 0xh iiccln xxh iicfn 0xh set stcenn, set iicrsvn bit iiccn xxh acken = wtimn = spien = 1 iicen = 1 sptn = 1 svan xxh spien = 1 start yes spdn = 1? stcenn = 1? iicrsvn = 0? a no yes yes no intiicn interrupt occurred? intiicn interrupt occurred? yes no yes no spdn = 1? yes no no intiicn interrupt occurred? yes no 1 b spien = 0 yes no set ports slave operation slave operation bus release status for a certain period confirmation of bus status is in progress confirm bus status note master operation started? communication reservation enable communication reservation disable see table 4-19 using port pin as alternate-function pin to set the i 2 c mode before this function is used. transfer clock selection local address setting start condition setting (communication start request issued) (no communication start request) ? waiting for slave specification from another master ? waiting for communication start request (depending on user program) communication start preparation (stop condition generation) waiting for stop condition detection slave operation waiting for communication request communication waiting initial settings note confirm that the bus release stat us (iiccln.cldn bit = 1, iiccln.da dn bit = 1) has been maintained for a certain period (1 frame, for example). when the sd a0n pin is constantly lo w level, determine whether to release the i 2 c0n bus (scl0n, sda0n pins = high level) by referring to the spec ifications of the product in communication. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 677 figure 17-19. master operation in multimaster system (2/3) sttn = 1 yes mstsn = 1? excn = 1 or coin =1? no intiicn interrupt occurred? yes yes no no a c sttn = 1 yes iicbsyn = 0? excn = 1 or coin =1? no no intiicn interrupt occurred? yes yes no yes stcfn = 0? no b d c d wait slave operation communication start preparation (start condition generation) securing wait time by software (see table 17-6 ) waiting for bus release (communication reserved) wait status after stop condition detection and start condition generation by communication reservation function wait slave operation communication start preparation (start condition generation) communication reservation disabled communication reservation enabled securing wait time by software (see table 17-7 ) waiting for bus release stop condition detection communication processing communication processing remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 678 figure 17-19. master operation in multimaster system (3/3) iicn write wtimn = 1 wreln = 1 iicn read acken = 1 wtimn = 0 wtimn = wreln = 1 acken = 0 iicn write yes trcn = 1? mstsn = 1? no yes yes no intiicn interrupt occurred? yes no yes no intiicn interrupt occurred? yes no intiicn interrupt occurred? no yes ackdn = 1? no yes no c 2 yes mstsn = 1? no yes no yes ackdn = 1? no 2 yes mstsn = 1? no 2 yes no intiicn interrupt occurred? yes mstsn = 1? no c 2 yes excn = 1 or coin = 1? no 1 2 sptn = 1 sttn = 1 end restarted? communication start (address, transfer direction specification) transmission start waiting for data transmission reception start transfer completed? waiting for ack detection waiting for data transmission not in communication transfer completed? waiting for ack detection slave operation communication processing communication processing remarks 1. conform the transmission and reception formats to the specifications of the product in communication. 2. when using the v850es/sj2, v850 es/sj2-h as the master in t he multimaster system, read the iicsn.mstsn bit for each intiicn interrupt o ccurrence to confirm the arbitration result. 3. when using the v850es/sj2, v850 es/sj2-h as the slave in the multimaster system, confirm the status using the iicsn and iicfn registers for eac h intiicn interrupt occurrence to determine the next processing. 4. n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 679 17.16.3 slave operation the following shows the processing procedure of the slave operation. basically, the operation of the slave device is event-dri ven. therefore, processing by an intiicn interrupt (processing requiring a significant change of the operat ion status, such as stop condition detection during communication) is necessary. the following description assumes that data communication does not support extension codes. also, it is assumed that the intiicn interrupt servicing performs only status change processing and t hat the actual data communication is performed during the main processing. figure 17-20. software out line during slave operation i 2 c intiicn signal setting, etc. setting, etc. flag data main processing interrupt servicing therefore, the following three flags are prepared so that the data trans fer processing can be performed by transmitting these flags to the main processing instead of intiicn signal. (1) communication mode flag this flag indicates the following communication statuses. clear mode: data communication not in progress communication mode: data communication in progress (valid address detection stop condition detection, ack from master not detected, address mismatch) (2) ready flag this flag indicates that data communication is enabled. th is is the same status as an intiicn interrupt during normal data transfer. this flag is set in the interrupt processing block and cleared in the main processing block. the ready flag for the first data for transmission is not set in the interrupt processing bl ock, so the first data is transmitted without clear processing (the address ma tch is regarded as a request for the next data). (3) communication direction flag this flag indicates the direction of communication and is the same as the value of iicsn.trcn bit.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 680 the following shows the operation of the main processing block during slave operation. start i 2 c0n and wait for the communication enabled status. when communication is enabled, perform transfer using the communication mode flag and ready flag (the pr ocessing of the stop condition and start condition is performed by interrupts, conditions are confirmed by flags). for transmission, repeat the transmission operation until the master device stops returning ack. when the master device stops returning ack, transfer is complete. for reception, receive the required number of data and do not return ack for the next data immediately after transfer is complete. after that, the master device generates the stop condition or restart c ondition. this causes exit from communications.
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 681 figure 17-21. slave operation flowchart (1) yes yes yes yes yes yes yes no no no no no no iicn read wreln = 1 ackdn = 1? clear communication mode flag wreln = 1 iicn write iiccn xxh acken = wtimn = 1 spien = 0, iicen = 1 svan xxh iicxn 0xh iiccln xxh iicfn 0xh set iicrsvn no yes no yes no start communication mode flag = 1? communication mode flag = 1? communication direction flag = 1? ready flag = 1? communication direction flag = 0? clear ready flag clear ready flag communication direction flag = 1? local address setting set ports transfer clock selection start condition setting transmission start reception start communication mode flag = 1? ready flag = 1? see table 4-19 using port pin as alternate-function pin to set the i 2 c mode before this function is used. initial settings communication processing remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 682 the following shows an example of the proc essing of the slave device by an int iicn interrupt (it is assumed that no extension codes are used here). during an intiicn interr upt, the status is confirm ed and the following steps are executed. <1> when a stop condition is detect ed, communication is terminated. <2> when a start condition is detected, the address is confirmed. if the address does not match, communication is terminated. if the address matches, the communica tion mode is set and wait is released, and operation returns from the interrupt (the ready flag is cleared). <3> for data transmission/reception, w hen the ready flag is set, operation retu rns from the interrupt while the i 2 c0n bus remains in the wait status. remark <1> to <3> in the above correspond to <1> to <3> in figure 17-22 slave operation flowchart (2) . figure 17-22. slave operation flowchart (2) yes yes yes no no no intiicn occurred spdn = 1? stdn = 1? coin = 1? communication direction flag trcn set communication mode flag clear ready flag set ready flag interrupt servicing completed clear communication direction flag, ready flag, and communication mode flag <1> <2> <3> remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 683 17.17 timing of data communication when using i 2 c bus mode, the master dev ice generates an address via the serial bus to select one of several slave devices as its communication partner. after outputting the slave address, t he master device transmits the iicsn .trcn bit, which specifies the data transfer direction, and then starts seri al communication with the slave device. the shift operation of the iicn register is synchronized with the falling edge of the serial clock pin (scl0n). the transmit data is transferred to the so latch and is output (msb first) via the sda0n pin. data input via the sda0n pin is captured by the iicn register at the ri sing edge of the scl0n pin. the data communication timing is shown below. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 684 figure 17-23. example of m aster to slave communication (when 9-clock wait is selected for both master and slave) (1/3) (a) start condition ~ address iicn ackdn stdn spdn wtimn h h l l l l h h h l l acken mstsn sttn sptn wreln intiicn trcn iicn ackdn stdn spdn wtimn acken mstsn sttn sptn wreln intiicn trcn scl0n sda0n 123456789 4 3 2 1 ad6 ad5 ad4 ad3 ad2 ad1 ad0 w ack d4 d5 d6 d7 iicn address iicn data iicn ffh note transmit start condition receive (when excn = 1) note processing by master device transfer lines processing by slave device note to cancel slave wait, write ffh to iicn or set wreln. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 685 figure 17-23. example of m aster to slave communication (when 9-clock wait is selected for both master and slave) (2/3) (b) data iicn ackdn stdn spdn wtimn h h l l l l l l h h h h l l l l l acken mstsn sttn sptn wreln intiicn trcn iicn ackdn stdn spdn wtimn acken mstsn sttn sptn wreln intiicn trcn scl0n sda0n 1 9 8 23456789 3 2 1 d7 d0 d6 d5 d4 d3 d2 d1 d0 d5 d6 d7 iicn data iicn ffh note iicn ffh note iicn data transmit receive note note ack ack processing by master device transfer lines processing by slave device note to cancel slave wait, write ffh to iicn or set wreln. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 686 figure 17-23. example of m aster to slave communication (when 9-clock wait is selected for both master and slave) (3/3) (c) stop condition iicn ackdn stdn spdn wtimn h h l l l l h h h l acken mstsn sttn sptn wreln intiicn trcn iicn ackdn stdn spdn wtimn acken mstsn sttn sptn wreln intiicn trcn scl0n sda0n 123456789 2 1 d7 d6 d5 d4 d3 d2 d1 d0 ad5 ad6 iicn data iicn data iicn ffh note iicn ffh note stop condition start condition transmit note note (when spien = 1) receive (when spien = 1) ack processing by master device transfer lines processing by slave device note to cancel slave wait, write ffh to iicn or set wreln. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 687 figure 17-24. example of sl ave to master communication (when 8-clock wait for master and 9-cl ock wait for slave are selected) (1/3) (a) start condition ~ address iicn ackdn stdn spdn wtimn h h l l l h l acken mstsn sttn l l sptn wreln intiicn trcn iicn ackdn stdn spdn wtimn acken mstsn sttn sptn wreln intiicn trcn scl0n sda0n 123456789 4 56 3 2 1 ad6 ad5 ad4 ad3 ad2 ad1 ad0 r d4 d3 d2 d5 d6 d7 iicn address iicn ffh note note iicn data start condition ack processing by master device transfer lines processing by slave device note to cancel master wait, writ e ffh to iicn or set wreln. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 688 figure 17-24. example of sl ave to master communication (when 8-clock wait for master and 9-cl ock wait for slave are selected) (2/3) (b) data iicn ackdn stdn spdn wtimn h h h l l l l l l l h h l l l l l acken mstsn sttn sptn wreln intiicn trcn iicn ackdn stdn spdn wtimn acken mstsn sttn sptn wreln intiicn trcn scl0n sda0n 1 89 23456789 3 2 1 d7 d0 ack d6 d5 d4 d3 d2 d1 d0 ack d5 d6 d7 note note receive transmit iicn data iicn data iicn ffh note iicn ffh note processing by master device transfer lines processing by slave device note to cancel master wait, writ e ffh to iicn or set wreln. remark n = 0 to 2
chapter 17 i 2 c bus user?s manual u16603ej5v1ud 689 figure 17-24. example of sl ave to master communication (when 8-clock wait for master and 9-cl ock wait for slave are selected) (3/3) (c) stop condition iicn ackdn stdn spdn wtimn h h l l l acken mstsn sttn sptn wreln intiicn trcn iicn ackdn stdn spdn wtimn acken mstsn sttn sptn wreln intiicn trcn scl0n sda0n 12345678 9 1 d7 d6 d5 d4 d3 d2 d1 d0 ad6 iicn address iicn ffh note note iicn data stop condition start condition (when spien = 1) nack (when spien = 1) processing by master device transfer lines processing by slave device note to cancel master wait, writ e ffh to iicn or set wreln. remark n = 0 to 2
user?s manual u16603ej5v1ud 690 chapter 18 iebus controller iebus (inter equipment bus) is a sma ll-scale digital data transfer system that transfers data between units. to implement iebus with the v850es/sj2 a nd v850es/sj2-h, an external iebus driver and receiver are necessary because they are not provided. the internal iebus controller of the v850es/ sj2 and v850es/sj2-h is of negative logic. the following models of the v850es/sj2 and v8 50es/sj2-h have an on-chip iebus controller. ? pd703274, 703274y, 70f3274, 70f3274y, 703275, 703275y, 703276, 703276y, 70f3276, 70f3276y, 703275hy, 703276hy, 70f3276hy 18.1 functions 18.1.1 communication protocol of iebus the communication protocol of the iebus is as follows. (1) multi-task mode all the units connected to the iebus c an transfer data to the other units. (2) broadcasting comm unication function communication between one unit and multiple units can be performed as follows. ? group-unit broadcast communication: broadcast communication to group units ? all-unit broadcast communication: broadcast communication to all units. (3) effective transfer rate the effective transfer rate is in mode 1 or mode 2 (the v850es/sj2 and v850es/sj2-h do not support mode 0 for the effective transfer rate). ? mode 1: approx. 17 kbps ? mode 2: approx. 26 kbps caution different modes must not be mixed on one iebus. (4) communication mode data transfer is executed in half-duplex asynchronous communication mode. (5) access control: csma/cd (carrier sense multiple access with collision detection) the priority of the iebus is as follows: <1> broadcast communication takes precedence over individual communication (communication from one unit to another). <2> the lower master address takes precedence. (6) communication scale the communication scale of iebus is as follows. ? number of units: 50 max. ? cable length: 150 m max. (when twisted pair cable is used) caution the communication scale in an actual system differs depending on the characteristics of the cables, etc., constituting the ie bus driver/receiver and iebus.
chapter 18 iebus controller user?s manual u16603ej5v1ud 691 18.1.2 determination of bus mastership (arbitration) an operation to occupy the bus is performed when a unit connected to the iebus controls the other units. this operation is called arbitration. when two or more units simultaneously start transmission, arbitration is used to grant one of the units the permission to occupy the bus. because only one unit is granted the bus ma stership as a result of arbitration, the priority conditions of the bus are predetermined as follows. caution the bus mastership is rele ased if communication is aborted. (1) priority by communication type broadcast communication (communication from one unit to multiple units) takes precedence over normal communication (communication from one unit to another). (2) priority by master address if the communication type is the same, communication with the lower master address takes precedence. a master address consists of 12 bits, with unit 000h having the highest priority and unit fffh having the lowest priority. 18.1.3 communication mode the iebus has three communication modes each havi ng a different transfer rate. the v850es/sj2 and v850es/sj2-h support communication modes 1 and 2. the tr ansfer rate and the maximum number of transfer bytes in one communication frame in communication modes 1 and 2 are as shown in table 18-1. table 18-1. transfer rate and maximum number of transfer bytes in each communication mode communication mode maximum number of transfer byte s (bytes/frame) effective transfer rate (kbps) note 1 32 approx. 17 2 128 approx. 26 note the effective transfer rate when the maximu m number of transfer bytes is transmitted. select the communication mode for each unit connected to the iebus before starting communication. if the communication mode of the master unit an d that of the part ner unit (slave unit) are not the same, communication is not correctly executed. 18.1.4 communication address with the iebus, each unit is assigned a specific 12-bi t address. this communication address consists of the following identifi cation numbers. ? higher 4 bits: group number (number to identify the group to which each unit belongs) ? lower 8 bits: unit number (number to identify each unit in a group)
chapter 18 iebus controller user?s manual u16603ej5v1ud 692 18.1.5 broadcast communication normally, transmission or reception is performed betwee n the master unit and its partner slave unit on a one-to- one basis. during broadcast communication, however, two or more slave units exist and the master unit executes transmission to these slave units. because two or more slave units exist, the nack signal is returned by the communicating slave unit as an acknowledge bit. whether broadcast communication or normal communication is to be executed is selected by the broadcast bit (for this bit, see 18.1.6 (2) broadcast bit ). broadcast communication is classified into two types: group-unit broadcast communication and all-unit broadcast communication. group-unit broadcast and all-unit broadcast are identified by the value of the slave address (for the slave address, see 18.1.6 (4) slave address field ). (1) group-unit broadcast communication broadcast communication is performed to the units in a gr oup identified by the group number indicated by the higher 4 bits of the communication address. (2) all-unit broadcast communication broadcast communication is performed to all the uni ts, regardless of the value of the group number. 18.1.6 transfer format of iebus figure 18-1 shows the transfer signal format of the iebus. figure 18-1. iebus transfer signal format header master address field slave address field control field telegraph length field data field start bit broad- cast bit master address bit p frame format slave address bit pa control bit pa tele- graph length bit pa data bit pa data bit pa remarks 1. p: parity bit a: acknowledge (ack/nack) bit 2. the master unit ignores the acknowled ge bit during broadcast communication. (1) start bit the start bit is a signal that informs the other units of th e start of data transfer. the unit that is to start data transfer outputs a high-level signal (start bit) from the ietx pin for a specific time, and then starts outputting the broadcast bit. if another unit has already output its st art bit when one unit is to output the start bit, this unit does not output the start bit but waits for completion of output of the st art bit by the other unit. when the output of the start bit by the other unit is complete, the un it starts outputting the broadcast bit in synchronization with the completion of the start bit output by the other unit. the units other than the one that ha s started communication detect this start bit, and enter the reception status.
chapter 18 iebus controller user?s manual u16603ej5v1ud 693 (2) broadcast bit this bit indicates whether the master selects one sl ave (individual communication) or multiple slaves (broadcast communication) as the other party of communication. when the broadcast bit is 0, it indicates broadcast co mmunication; when it is 1, individual communication is indicated. broadcast communication is classified into two types: group-unit communication and all-unit communication. these communication types are identified by the value of the slave address (for the slave address, see 18.1.6 (4) slave address field ). because two or more slave units exist as a partner slave unit of communication in the case of broadcast communication, the nack signal is returned as an acknowledge bit in each field subsequent to the master address field. if two or more units start transmitting a communication frame at the same time, broadcast communication takes precedence over individual communication, and wins in arbitration. if one unit occupies the bus as the master, the value set to the broadcast request flag (bcr.allrq bit) is output. (3) master address field the master address field is out put by the master to inform a sl ave of the master?s address. the configuration of the master address field is as shown in figure 18-2. if two or more units start transmitting the broadcast bit at the same time, the master address field makes a judgment of arbitration. the master address field compares the da ta it outputs with the data on the bus each time it has output one bit. if the master address output by the master address field is found to be different from the data on the bus as a result of comparison, it is assumed that the master has lost in arbitrat ion. as a result, the master stops transmission and enters the reception status. because the iebus is configured of wired and, the un it having the minimum master address of the units participating in arbitration (arbitration masters) wins in arbitration. after a 12-bit master address has been output, only one uni t remains in the transmission status as one master unit. next, this master unit outputs a parity bit, determines th e master address of other unit, and starts outputting a slave address field. if one unit occupies the bus as the master, the address set by the uar register is output. figure 18-2. master address field master address field master address (12 bits) msb lsb parity
chapter 18 iebus controller user?s manual u16603ej5v1ud 694 (4) slave address field the master outputs the addr ess of the unit with which it is to communicate. figure 18-3 shows the configuratio n of the slave address field. a parity bit is output after a 12-bit slave address has been transmitted in order to prevent a wrong slave address from being received by mistake. next, the ma ster unit detects an ack signal from the slave unit to confirm that the slave unit exists on the bus. when the master has detected the ack signal, it starts outputting the control field. during broadcast communication, howe ver, the master does not co nfirm the acknowledge bit but starts outputting the control field. the slave unit outputs the ack signal if its slave address matches and if t he slave detects that the parities of both the master address and slave address are even. th e slave unit judges that the master address or slave address has not been correctly received and outputs the nack signal if the parities are odd. at this time, the master unit is in the standby (monitor) status, and communication ends. during broadcast communication, the slave address is used to identify group-unit broadcast or all-unit broadcast, as follows:. if slave address is fffh: all-unit broadcast communication if slave address is other than fffh: gr oup-unit broadcast communication remark the group no. during group-unit broadcasting communi cation is the value of the higher 4 bits of the slave address. if one unit occupies the bus as the master, the address set by the sar register is output. figure 18-3. slave address field slave address field unit no. msb lsb ack parity slave address (12 bits) group no.
chapter 18 iebus controller user?s manual u16603ej5v1ud 695 (5) control field the master outputs the operation it requires the slave to perform, by using this field. the configuration of t he control field is as shown in figure 18-4. if the parity following the control bit is even and if the slave unit can execute the function required by the master unit, the slave unit outputs an ack signal and star ts outputting the telegraph l ength field. if the slave unit cannot execute the function required by the master unit even if the parity is even, or if the parity is odd, the slave unit outputs the nack signal, and returns to the standby (monitor) status. the master unit starts outputting the telegr aph field after detecting the ack signal. if the master can detect the nack signal, the master unit enters the standby status, and communication ends. during broadcast communication, however, the master un it does not confirm the acknowledge bit, and starts outputting the telegraph length field. the contents of the contro l bits are shown below. table 18-2. contents of control bits bit 3 note 1 bit 2 bit 1 bit 0 function 0 0 0 0 read slave status 0 0 0 1 undefined 0 0 1 0 undefined 0 0 1 1 read data and lock note 2 0 1 0 0 read lock address (lower 8 bits) note 3 0 1 0 1 read lock address (higher 4 bits) note 3 0 1 1 0 read slave status and unlock note 2 0 1 1 1 read data 1 0 0 0 undefined 1 0 0 1 undefined 1 0 1 0 write command and lock note 2 1 0 1 1 write data and lock note 2 1 1 0 0 undefined 1 1 0 1 undefined 1 1 1 0 write command 1 1 1 1 write data notes 1. the telegraph length bit of the telegraph length fi eld and data transfer dire ction of the data field change as follows depending on the value of bit 3 (msb). if bit 3 is ?1?: transfer from master unit to slave unit if bit 3 is ?0?: transfer from slave unit to master unit 2. this is a control bit that specifies locking or unlocking (see 18.1.7 (4) locking and unlocking ). 3. the lock address is transferred in 1-byte (8-bit) units and is configured as follows: msb lower 8 bits undefined higher 4 bits control bit: 4h control bit: 5h lsb
chapter 18 iebus controller user?s manual u16603ej5v1ud 696 if the control bit received from the mast er unit is not as shown in table 18- 3, the unit locked by the master unit rejects acknowledging the control bit, and outputs the nack signal. table 18-3. control fi eld for locked slave unit bit 3 bit 2 bit 1 bit 0 function 0 0 0 0 read slave status 0 1 0 0 read lock address (lower 8 bits) 0 0 0 1 read lock address (higher 4 bits) moreover, units for which lock is not set by the mast er unit reject acknowledgment and output a nack signal when the control data shown in table 18-4 is acknowledged. table 18-4. control fiel d for unlocked slave unit bit 3 bit 2 bit 1 bit 0 function 0 1 0 0 lock address r ead (lower 8 bits) 0 1 0 1 lock address read (higher 4 bits) if one unit occupies the bus as the master, t he value set to the cdr register is output. figure 18-4. control field msb lsb ack parity control bit (4 bits) control field
697 user?s manual u16603ej5v1ud table 18-5. acknowledge signal ou tput condition of control field (a) if received control da ta is ah, bh, eh, or fh received control data communication type (usr.alltrans bit) individual communication = 0 broadcast communication = 1 communication target (usr.slvrq bit) slave specification = 1 no specification = 0 lock status (usr.lock bit) lock = 1 unlock = 0 master unit identification (match with par register) lock request unit = 1 other = 0 slave transmission enable (bcr.enslvtx bit) slave reception enable (bcr.enslvrx bit) ah bh eh fh 0 don?t care 0 1 1 1 don?t care 1 { other than above (b) if received control data is 0h, 3h, 4h, 5h, 6h, or 7h received control data communication type (usr.alltrans bit) individual communication = 0 broadcast communication = 1 communication target (usr.slvrq bit) slave specification = 1 no specification = 0 lock status (usr.lock bit) lock = 1 unlock = 0 master unit identification (match with par register) lock request unit = 1 other = 0 slave transmission enable (bcr.enslvtx bit) slave reception enable (bcr.enslvrx bit) 0h 3h 4h 5h 6h 7h 0 { { 0 don?t care 1 { { { { 0 don?t care { { { 0 { { { { 0 1 1 1 1 don?t care { { { { { { other than above caution if the received control data is ot her than the data shown in table 18-5, (nack signal is returned) is unconditiona lly assumed. remark { : ack signal is returned. : nack signal is returned. chapter 18 iebus controller
chapter 18 iebus controller user?s manual u16603ej5v1ud 698 (6) telegraph length field this field is output by the transmission side to inform t he reception side of the number of bytes of the transmit data. the configuration of the telegraph length field is as shown in figure 18-5. table 18-6 shows the relationship between the tele graph length bit and the number of transmit data. figure 18-5. telegraph length field msb lsb telegraph length field telegraph length bit (8 bits) parity ack table 18-6. contents of telegraph length bit telegraph length bit (hex) number of transmit data bytes 01h 1 byte 02h 2 bytes | | ffh 255 bytes 00h 256 bytes the operation of the telegraph lengt h field differs depending on whether the master transmits data (when control bit 3 is 1) or receives data (when control bit 3 is 0). (a) when master transmits data the telegraph length bit and parity bit are output by the master unit and the synchronization signals of bits are output by the master unit. when the slave unit detects that the parity is even, it outputs the ack signal, and starts outputting the data field. du ring broadcast communication, however, the slave unit outputs the nack signal. if the parity is odd, the slave unit judges that the telegraph length bit has not been correctly received, outputs the nack signal, and returns to the standby (monitor) status. at this time, the master unit also returns to the standby status, and communication ends. (b) when master receives data the telegraph length bit and parity bit are output by th e slave unit and the synchronization signals of bits are output by the master unit. if the master unit det ects that the parity bit is even, it outputs the ack signal. if the parity bit is odd, the master unit judges that t he telegraph length bit has not been correctly received, outputs the nack signal, and returns to the standby status. at this time, the slave unit also returns to the standby status, and communication ends.
chapter 18 iebus controller user?s manual u16603ej5v1ud 699 (7) data field this is data output by the transmission side. the master unit transmits or receives data to or from a slave unit by using the data field. the configuration of the data field is as shown below. figure 18-6. data field data field (number specified by telegraph length field) msb lsb one data ack parity data bit (8 bits) ack parity following the data bit, the parity bit and acknowledge bit are respectively output by the master unit and slave unit. use broadcast communication only for when the master unit tr ansmits data. at this time, the acknowledge bit is ignored. the operation differs as follows depending on whether the master transmits or receives data. (a) when master transmits data when the master units writes data to a slave unit, the master unit transmits the data bit and parity bit to the slave unit. if the parity is even and the receive data is not stored in the dr register when the slave unit has received the data bit and parity bit, the slave unit outputs an ack signal. if the parity is odd or if the receive data is stored in the dr register, the slave unit rejects receiving the data, and outputs the nack signal. if the slave unit outputs the nack signal, the master unit transmits the same dat a again. this operation continues until the master detects the ack signal from the slave unit, or the data exceeds the maximum number of transmit bytes. if there is more data and the maximum number of tran smit bytes is not exceeded when the parity is even and when the slave unit outputs the ack signal , the master unit transmits the next data. during broadcast communication, the slave unit outputs the nack signal, and the master unit transfers 1 byte of data at a time. if the parity is odd or the dr register is storing receive data after the slave unit has received the data bit and parity bit during broadcast communication, the slave unit judges that reception has not been performed corre ctly, and stops reception.
chapter 18 iebus controller user?s manual u16603ej5v1ud 700 (b) when master receives data when the master unit reads data from a slave unit, the master unit outputs a sync signal corresponding to all the read bits. the slave unit outputs the co ntents of the data and parity bits to t he bus in response to the sync signal from the master unit. the master unit reads the data and parity bits out put by the slave unit, and checks the parity. if the parity is odd, or if the dr register is storing a receive data, the master unit rejects accepting the data, and outputs the nack signal. if the maximum number of transmit bytes is within the value that can be transmitted in one communication frame, the ma ster unit repeats reading the same data. if the parity is even and the dr regist er is not storing a receive data, the master unit accepts the data and outputs the ack signal. if the maximum number of transmit bytes is within the value that can be transmitted in one frame, the mast er unit reads the next data. caution do not operate master reception in broadcast comm unication, because the slave unit cannot be defined and da ta transfer cannot be performed correctly. (8) parity bit the parity bit is used to check to s ee if the transmit data has no error. the parity bit is appended to each data of the master address, slave address, control, telegraph length, and data bits. the parity is an even parity. if the number of bits in data that are ?1? is odd, the parity bit is ?1?. if the number of bits in the data that are ?1? is even, the parity bit is ?0?. (9) acknowledge bit during normal communication (communication from one unit to another), an acknowledge bit is appended to the following locations to check if the data has been correctly received. ? end of slave address field ? end of control field ? end of telegraph length field ? end of data field the definition of the ackno wledge bit is as follows. ? 0: indicates that the transmit data is recognized (ack signal). ? 1: indicates that the transmit data is not recognized (nack signal). during broadcast communication, however, the c ontents of the acknowledge bit are ignored. (a) last acknowledge bit of slave field the last acknowledge bit of the slave field serves as a nack signal in any of the following cases, and transmission is stopped. ? if the parity of the master address bit or slave address bit is incorrect ? if a timing error (error in bit format) occurs ? if a slave unit does not exist
chapter 18 iebus controller user?s manual u16603ej5v1ud 701 (b) last acknowledge bit of control field the last acknowledge bit of the control field serves as a nack signal in any of the following cases, and transmission is stopped. ? if the parity of the control bit is incorrect ? if control bit 3 is ?1? (write operation) when the sl ave reception enable flag (bcr.enslvrx bit) is not set (1) note ? if the control bit indicates reading of data (3h or 7h) when the slave transmission enable flag (bcr.enslvtx bit) is not set (1) ? if a unit other than that has set locking requests 3h, 6h, 7h, ah, bh, eh, or fh of the control bit when locking is set ? if the control bit indicates reading of lock a ddresses (4h, 5h) even when locking is not set ? if a timing error occurs ? if the control bit is undefined cautions 1. the ack signal is always returned wh en the control data of the slave status request is received, even if the enslvtx bit = 0. 2. the nack signal is returned by the ackno wledge bit in the control field when the control data for data/comma nd writing is received, even if the enslvrx bit = 0. slave reception can be di sabled (communication stopped) by enslvrx bit only in the case of individual comm unication. in the case of broadcast communication, communication is maintained and the data request interrupt request signal (intie1) or iebus end interrupt request signal (intie2) is generated. (c) last acknowledge bit of telegraph length field the last acknowledge bit of the tel egraph length field serves as a nack signal in any of the following cases, and transmission is stopped. ? if the parity of the telegraph length bit is incorrect ? if a timing error occurs (d) last acknowledge bit of data field the last acknowledge bit of the data field serves as a nack signal in any of the following cases, and transmission is stopped. ? if the parity of the data bit is incorrect note ? if a timing error occurs after the preceding acknowledge bit has been transmitted ? if the receive data is stored in the dr register and no more data can be received note note in this case, when the communication executed is individual communication, if the maximum number of transmit bytes is within the valu e that can be transmitted in one frame, the transmission side executes transmission of that dat a field again. for broadcast communication, the transmission side does not execute transmission again, a communication error occurs on the reception side and reception stops.
chapter 18 iebus controller user?s manual u16603ej5v1ud 702 18.1.7 transfer data (1) slave status the master unit can learn why the slave unit did not return the ack signal by reading the slave status. the slave status is determined according to the result of the last communication the slave unit has executed. all the slave units can supply in formation on the slave status. the configuration of the slav e status is shown below. figure 18-7. bit configuration of slave status msb lsb bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit 0 note 1 meaning 0 transmit data is not written in dr register 1 transmit data is written in dr register bit 1 note 2 meaning 0 receive data is not stored in dr register 1 receive data is stored in dr register bit 2 meaning 0 unit is not locked 1 unit is locked bit 3 meaning 0 fixed to 0 bit 4 note 3 meaning 0 slave transmission is stopped 1 slave transmission is ready bit 5 meaning 0 fixed to 0 bit 7 bit 6 meaning 0 0 mode 0 0 1 mode 1 1 0 mode 2 1 1 not used indicates the highest mode supported by the unit note 4 . notes 1. after reset: bit 0 is set to 1. 2. the receive buffer size is 1 byte. 3. when the v850es/sj2 serves as a slave unit, this bit corresponds to the status indicated by bcr.enslvtx bit. 4. bits 7 and 6 are fixed to ?10? because the v850es/sj2 and v850es/sj2-h can support modes 1 and 2.
chapter 18 iebus controller user?s manual u16603ej5v1ud 703 (2) lock address when the lock address is read (control bit: 4h or 5h), the address (12 bits) of the master unit that has issued the lock instruction is configured in 1- byte units as shown below and read. figure 18-8. configuration of lock address msb lower 8 bits undefined higher 4 bits control bit: 4h control bit: 5h lsb (3) data if the control bit indicates reading of data (3h or 7h), the data in the data buffer of the slave unit is read by the master unit. if the control bit indicates writing of data (bh or fh), the data received by the slave unit is processed according to the operation rule of that slave unit. (4) locking and unlocking the lock function is used when a message is transferred in two or more communication frames. the unit that is locked does not receive data from units other than the one that has locked the unit (does not receive broadcast communication). a unit is locked or unlocked as follows. (a) locking if the communication frame is completed without succeedi ng to transmit or receive data of the number of bytes specified by the telegraph length bit after the telegraph length field has been transmitted or received (ack = 0) by the control bit that specifies locking (3 h, ah, or bh), the slave unit is locked by the master unit. at this time, the bit (bit 2) in the byte indicating the slave status is set to ?1?. (b) unlocking after transmitting or receiving data of the number of dat a bytes specified by the telegraph length bit in one communication frame by the control bit that has specified locking (3h, ah, or bh), or the control bit that has specified unlocking (6h), the slave unit is unlocked by the master unit. at this time, the bit related to locking (bit 2) in the byte indicating the slave status is reset to ?0?. locking or unlocking is not performed during broadcast communication. locking and unlocking conditions are shown below.
chapter 18 iebus controller user?s manual u16603ej5v1ud 704 table 18-7. lock setting conditions broadcast communication i ndividual communication control data communication end frame end communication end frame end 3h, 6h note cannot be locked lock set ah, bh cannot be locked cannot be locked cannot be locked lock set 0h, 4h, 5h, eh, fh cannot be locked cannot be locked cannot be locked cannot be locked note the frame end of control data 6h (sla ve status read/unlock) occurs when the parity in the data field is odd, and when the nack signal from the iebus unit is r epeated up to the maximum number of transfer bytes with being output. table 18-8. unlock release conditions (while locked) broadcast communication from lock request unit individual communication from lock request unit control data communication end frame end communication end frame end 3h, 6h note unlocked remains locked ah, bh unlocked unlocked unlocked remains locked 0h, 4h, 5h, eh, fh remains locked remains locked remains locked remains locked note the frame end of control data 6h (sla ve status read/unlock) occurs when the parity in the data field is odd, and when the nack signal from the iebus unit is r epeated up to the maximum number of transfer bytes with being output. 18.1.8 bit format the format of the bits constituting the communi cation frame of the iebus is shown below. figure 18-9. bit format of iebus logic ?1? logic ?0? preparation period synchronization period data period stop period preparation period: first low-level (logic ?1?) period synchronization period: next high-level (logic ?0?) period data period: period indicating value of bit stop period: last low-level (logic ?1?) period the synchronization period and data period are almost equal to each other in length. the iebus synchronizes each bit. the specifications on the time of the entire bit and the time related to the period allocated to that bit differ depending on the type of the transm it bit, or whether the unit is the master unit or a slave unit. the master and slave units monitor whether each period (preparation period, synchronization period, data period, and stop period) is output for spec ified time while they are in communica tion. if a period is not output for the specified time, the master and slave units report a timing error, immediately terminate communication and enter the standby status.
chapter 18 iebus controller user?s manual u16603ej5v1ud 705 18.2 configuration the block diagram of the iebu s controller is shown below. figure 18-10. iebus cont roller block diagram ietx0 f xx to f xx /5 note ierx0 uar, sar ocks2 prescaler prescaler block 8 bcr, psr, isr esr, cdr, dlr, dr reception block transmission block transmit shift register receive shift register field processing block bit processing block interrupt control block internal register block iebus interface block interrupt request signal iebus controller internal bus ssr, usr, fsr, scr, ccr rar, rsa noise filter note f xx /4 and f xx /5 can be selected only in the v850es/sj2-h. (1) hardware configuration and functions iebus mainly consists of the following six internal blocks. ? interrupt control block ? internal registers ? bit processing block ? field processing block ? iebus interface block ? prescaler block
chapter 18 iebus controller user?s manual u16603ej5v1ud 706 (a) interrupt control block this control block transfers interrupt request si gnals from the iebus controller to the cpu. (b) internal registers these registers set data to the control registers and fields that control iebus (for t he internal registers, see 18.3 registers ). (c) bit processing block this block generates and breaks down bit timing, and ma inly consists of a bit sequence rom, 8-bit preset timer, and comparator. (d) field processing block this block generates each field in the communication frame, and mainly consists of a field sequence rom, 4-bit down counter, and comparator. (e) iebus interface block this is the interface block for an external driver/receive r, and mainly consists of a noise filter, shift register, and transmission/reception block (collision detector, parity detector, parity generator, and ack/nack generator). (f) prescaler block this block selects the clock to be supplied to the iebus controller.
chapter 18 iebus controller user?s manual u16603ej5v1ud 707 18.3 registers the registers that control the i ebus controller are shown below. table 18-9. control registers of iebus controller bit unit for manipulation address function register name symbol r/w 1 8 16 after reset fffff348h iebus clock select register ocks2 fffff360h iebus control register bcr fffff361h iebus power save register psr r/w 00h fffff362h iebus slave status register ssr 81h fffff363h iebus unit status register usr r fffff364h iebus interrupt status register isr fffff365h iebus error status register esr 00h fffff366h iebus unit address register uar fffff368h iebus slave address register sar r/w fffff36ah iebus partner address register par fffff36ch iebus receive slave address register rsa r 0000h fffff36eh iebus control data register cdr 00h fffff36fh iebus telegraph length register dlr 01h fffff370h iebus data register dr r/w fffff371h iebus field status register fsr 00h fffff372h iebus success count register scr 01h fffff373h iebus communication count register ccr r 20h
chapter 18 iebus controller user?s manual u16603ej5v1ud 708 (1) iebus control register (bcr) the bcr register is an 8-bit register that cont rols the operations of the iebus controller. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. after reset: 00h r/w address: fffff360h <7> <6> <5> <4> <3> 2 1 0 bcr eniebus mstrq allrq enslvtx enslvrx 0 0 0 eniebus communication enable flag 0 iebus unit stopped 1 iebus unit active mstrq master request flag 0 iebus unit not requested as master 1 iebus unit requested as master allrq broadcast request flag 0 individual communication requested 1 broadcast communication requested enslvtx slave transmission enable flag 0 slave transmission disabled 1 slave transmission enabled enslvrx slave reception enable flag 0 slave reception disabled 1 slave reception enabled cautions 1. while iebus is operating as the mast er, writing to the bcr register (including bit manipulation instructions) is disabled until either the end of that communication or frame, or until communication is stopped by the occurrence of an arbitration-loss communication error. master requests cannot therefore be multip lexed. however, the case when communication has b een forcibly stopped (eniebus flag = 0) is not problem. 2. if a bit manipulation instruction for the bcr register conflicts with a hardware reset of the mstrq bit, the bcr register may not operate normally. the following countermeasures are recommended in this case. ? because the hardware reset is instigated in the acknowledgment period of the slave address field, be sure to observe caution 1 of (b) master request flag (mstrq) below. ? be sure to observe the caution above regarding writing to the bcr register.
chapter 18 iebus controller user?s manual u16603ej5v1ud 709 (a) communication enable flag (eniebus)...bit 7 set: by software clear: by software the iebus controller participates in communication di fferently depending on the timing of setting the eniebus bit (1), as follows. table 18-10. timing of setting eniebus bit and participation in communication timing of setting eniebus bit how iebus c ontroller participates in communication if communication is not performed on iebus participat es in communication from the next frame or starts communication. if other bus master is communicating start bit while communication is in progress on iebus participates in communication from that frame if the start bit is detected. if the start bit is not detected, participates in communication from the next frame. if communication is in progress on iebus after start bit from other bus master is detected participates in communication from the next frame. if the eniebus bit is cleared (0), communication is i mmediately stopped even while it is in progress, and the internal flags and registers are reset, with some exceptions. the registers that are not reset by the eniebus bit are listed in the table below. the iebus controller does not respond even if another unit starts communication when the eniebus bit = 0. table 18-11. registers that are not reset by eniebus bit registers not reset by eniebus bit remark uar not reset sar not reset cdr data written from cpu is not reset but data received during communication is reset. dlr data written from cpu is not reset but data received during communication is reset. dr data written from cpu is not reset but data received during communication is reset. caution before setting the eniebus bit (1), the follo wing registers must be se t depending on the mode of communication to be started. table 18-12. registers that must be set before each communication mode of communication registers that must be set in advance master transmission uar, sar, cdr, dlr, dr (first 1-byte data) master reception uar, sar, cdr slave transmission note uar, dlr, dr (first 1-byte data) note slave reception uar note when starting slave transmission, information such as the value to be set to the dlr register and which data is to be returned (value to be set to t he dr register) must be assigned in advance.
chapter 18 iebus controller user?s manual u16603ej5v1ud 710 (b) master request flag (mstrq)...bit 6 set: by software clear: cleared (0) by hardware when master communica tion is started and immediately before the start interrupt of the master occurs. cleared (0) by hardware before a communication error occurs. when the eniebus bit is cleared. when the mstrq bit is set (1), the iebus controlle r starts communication on iebus as the master. if communication is in progress on iebus (if the start bit cannot be detected whil e the start bit is being communicated or if communication is in progress a fter the start bit has been detected), however, the controller waits until the current fram e ends (holds the master request pe nding), outputs the start bit after the frame has ended, and starts communication as the master. cautions 1. if the iebus contro ller has lost in arbitration, i ssue the master request again by software. in doing so, set (1) the mstrq bit at a timing other than that illustrated below. figure 18-11. timing at which mstrq bit cannot be set mstrq bit mstrq bit cannot be set (1) (approx. 167 ns (mode 1, at 6.29 mhz)). mstrq bit clear signal start interrupt request signal (intie2, intsta) 2. when a master request has been sent and bus mastersh ip acquired, do not set the mstrq, enslvtx, or enslvrx bit until the end of communication (i.e. the communication end flag (isr.endtrns bit) or frame end flag (isr.endfram bit) is set (1)) as setting these flags di sables interrupt request signal generation. however, these flags can be set if comm unication has been aborted. (c) broadcast request flag (allrq)...bit 5 set: by software clear: by software caution when requesting broad cast communication, always set (1 ) the allrq bit, then the mstrq bit.
chapter 18 iebus controller user?s manual u16603ej5v1ud 711 (d) slave transmission enable flag (enslvtx)...bit 4 set: by software clear: by software cautions 1. the enslvtx bit must be set before the parity bit in the c ontrol field is received. 2. clear the enslvtx bit (0) before setti ng the mstrq bit (1) when making a master request. this is to avoid transmission of the data of the dr register that tries master transmission if the controller loses in arbitr ation after master operation and if slave transmission is requested by the master. 3. when returning to an enabled state from a disabled state, transmission becomes valid from the next frame. 4. if control data (3h or 7h) for data/command writing is received when the enslvtx bit = 0, the nack signal is returned by the acknowledge bit in th e control field. 5. the status interrupt request signals (intie2, intsta) will be generated and communication continued when the control data of a slave status request is returned, even if the enslvtx bit = 0. (e) slave reception enable flag (enslvrx)...bit 3 set: by software clear: by software cautions 1. the enslvrx bit must be set before the parity bit in the c ontrol field is received. 2. while the cpu is busy with other proc essing, slave reception can be prevented by clearing the enslvrx bit (0). during in dividual communication, the nack signal is returned in the control field and communi cation is completed. during broadcast communication, communication cannot be completed because the acknowledge bit is ignored. however, the iebus contro ller does not respond to the broadcast communication and does not generate an interrupt request signal. 3. when returning to an enabled state from a disabled state, transmission becomes valid from the next frame.
chapter 18 iebus controller user?s manual u16603ej5v1ud 712 (2) iebus power save register (psr) the psr register is an 8-bit register that controls the internal clock and communication mode of the iebus controller. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. after reset: 00h r/w address: fffff361h <7> <6> 5 4 3 2 1 0 psr enclk iemode 0 0 0 0 0 0 enclk internal clock operation enable flag 0 stop internal clock of iebus controller 1 enable internal clock of iebus controller iemode iebus communication mode setting flag 0 set communication mode 1 1 set communication mode 2 cautions 1. do not set the psr register while communication is enabled (bcr.eniebus bit = 1). 2. be sure to clear bits 5 to 0 to ?0?.
chapter 18 iebus controller user?s manual u16603ej5v1ud 713 (3) iebus slave status register (ssr) the ssr register is an 8-bit register that indicates the communication status of the slave unit. after receiving a slave status transmission request from the master, read th is register by software, and write a slave status to the dr register to transmit the slave status. at this time , the telegraph length is automatically set to ?01h?, so setting of the dlr register is not requir ed (because it is preset by hardware). bits 6 and 7 indicate the highest mode supported by the unit, and are fixed to ?10? (mode 2). this register is read-only, in 8-bit or 1-bit units. reset sets this register to 81h. after reset: 81h r address: fffff362h 7 6 5 <4> 3 <2> <1> <0> ssr 1 0 0 statslv 0 statlock statrx stattx statslv slave transmission status flag 0 slave transmission stops 1 slave transmission enabled statlock lock status flag 0 unlock status 1 lock status statrx dr register receive status 0 receive data not stored in dr register 1 receive data stored in dr register stattx dr register transmit status 0 transmit data not stored in dr register 1 transmit data stored in dr register (a) slave transmission status flag (statslv)...bit 4 reflects the contents of the slave tr ansmission enable flag (bcr.enslvtx bit). (b) lock status flag (statlock)...bit 2 reflects the contents of the lock flag (usr.lock bit). (c) dr register reception status (statrx)...bit 1 this flag indicates the dr r egister reception state. (d) dr register transmission status (stattx)...bit 0 this flag indicates the dr register transmission state.
chapter 18 iebus controller user?s manual u16603ej5v1ud 714 (4) iebus unit status register (usr) the usr register is an 8-bit register that indicates the iebus unit status. this register is read-only, in 8-bit or 1-bit units. reset sets this register to 00h. after reset: 00h r address: fffff363h 7 <6> <5> <4> <3> 2 1 0 usr 0 slvrq arbit alltrns ack lock 0 0 slvrq slave request flag 0 no request from master to slave 1 request from master to slave arbit arbitration result flag 0 arbitration loss not occurred 1 arbitration loss occurred alltrns broadcast communication flag 0 individual communication status 1 broadcast communication status ack acknowledge tran smission flag 0 nack signal transmitted 1 ack signal transmitted lock lock status flag 0 unit unlocked 1 unit locked
chapter 18 iebus controller user?s manual u16603ej5v1ud 715 (a) slave request flag (slvrq)...bit 6 a flag indicating whether there has been a slave request from the master. set: when the unit is requested as a slave (if the condition in table 18-13 slave request condition (slvrq bit setting condition ) is satisfied), this flag is set (1) by hardware when the acknowledge period of the slave address field starts. clear: this flag is cleared (0) by hardware when the un it is not requested as a slave (if the condition in table 18-13 slave request conditi on (slvrq bit setting condition ) is not satisfied). the reset timing is the same as the set timing. if the unit is requested as a slave immediately after communication has been correctly received (when the slvrq bit = 1), and if a parity error occurs in the slave address field for that communication, the flag is not cleared. table 18-13. slave request condition (slvrq bit setting condition) status of unit received master address communication mode rece ived slave address individual uar register matching group matching not locked don?t care broadcast fffh individual uar register matching group matching locked locked master matching broadcast fffh caution if a unit other than the locked master communicates with the unit while the unit is locked, the slvrq bit is not set but the ack signa l is returned to the slave address field. this is because communication must be conti nued, even if a unit ot her than the locked master returns the signal, if the cont rol data is a slave status request. (b) arbitration result flag (arbit)...bit 5 a flag that indicates the result of arbitration. set: this flag is set (1) when the data output by the iebus unit during the arbitration period does not match the bus line data. clear: this flag is cleared (0) by the start bit timing. cautions 1. the timing at which th e arbitration result flag (arbit bi t) is cleared differs depending on whether the unit outputs a start bit. ? if start bit is output: the flag is cleared at the output start timing. ? if start bit is not output: the flag is clear ed at the detection timing of the start bit (approx. 160 s (mode 1, at 6.29 mhz) after output) 2. the flag is cleared (0) at the detection timing of the start bit if the other unit outputs the start bit earlier and the unit does not outpu t the start bit after the master request.
chapter 18 iebus controller user?s manual u16603ej5v1ud 716 (c) broadcast communicati on flag (alltrns)...bit 4 flag indicating whether the unit is performing broadc ast communication. the contents of the flag are updated in the broadcast field of each frame. except for initialization (reset) by system reset, the set/c lear conditions vary depending on the receive data of the broadcast field bit. set: when ?broadcast? is received by the broadcast field clear: when ?individual? is received by the broadc ast field, or upon the input of a system reset. caution the broadcast flag is updated regardless of whether ie bus is the communication target or not. figure 18-12. example of broad cast communication flag operation broadcast communication flag clear set not cleared by start bit iebus sequence start m11 broad- cast m10 m11 individual m10 start (d) acknowledge transmission flag (ack)...bit 3 a flag that indicates whether the ack signal has b een transmitted in the acknowledge bit period of the acknowledge bit field when iebus is the receiving uni t. the contents of the fl ag are updated in the acknowledge bit period of each frame. however, if the internal circuit is initialized by the occurrence of a parity error, etc., the contents are not updated in the acknowle dge bit period of that field. (e) lock status flag (lock)...bit 2 a flag that indicates whether the unit is locked. set: this flag is set (1) when the communication end flag (isr.endtrns bit) goes low and the frame end flag (isr.endfram bit) goes high after receipt of a lock specification (3h, 6h, ah, bh) in the control field. clear: when the communication enable flag (bcr.eniebus bit) is cleared (0). when the communication end flag (endtrns bit) is se t (1) after receipt of a lock release (3h, 6h, ah, bh) in the control field. caution lock specificati on/release is not possible in broa dcast communication. in the lock status, individual communication from a unit other than the one that requests locking is not acknowledged. however, even communicati on from a unit other than the one that requests locking is acknowledged as long as the communication is a slave status request.
chapter 18 iebus controller user?s manual u16603ej5v1ud 717 (5) iebus interrupt status register (isr) the isr register indicates the interrupt source when iebu s issues an interrupt request signal. this register is read to generate an interrupt request signal, after wh ich the specified interrupt processing is carried out. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. after reset: 00h r/w note 1 address: fffff364h 7 <6> <5> <4> <3> <2> 1 0 isr 0 ieerr startf statusf endtrns endfram 0 0 ieerr communication error flag (during communication) 0 no communication error 1 communication error startf start interrupt flag 0 start interrupt request signal did not occur 1 start interrupt request signal occurred statusf status transmission flag (slave) 0 no slave status/lock address (higher 4 bits, lower 8 bits) transmission request 1 slave status/lock address (higher 4 bi ts, lower 8 bits) transmission request endtrns communication end flag 0 communication does not end after the number of bytes set in the telegraph length field have been transferred 1 communication ends after the number of bytes set in the telegraph length field have been transferred endfram frame end flag 0 the frame (communication of the maximum number of transfer bytes note 2 ) does not end 1 the frame (communication of the maximum number of transfer bytes note 2 ) ends notes 1. only the ieerr bit can be written, and only to 0 (i.e., the ieerr bit can only be cleared). the ieerr bit is not set (1) even if 1 is written to it. 2. mode 1: 32 bytes mode 2: 128 bytes
chapter 18 iebus controller user?s manual u16603ej5v1ud 718 (a) communication error flag (ieerr)...bit 6 a flag that indicates a communication error has o ccurred. when a communication error occurs, the intie2 and interr interrupt request signals are generated. set: the flag is set (1) if a timing error, parity error (except in the data field), nack reception error (except in the data field), underrun error, overrun error (that occurs during broadcast communication reception), or write error occurs. clear: by software (b) start interrupt flag (startf)...bit 5 a flag that indicates the start interrupt. when a star t interrupt occurs, the in tie2 and intsta interrupt request signals are generated. set: this flag is set (1) in the slave address field, upon a master request. when iebus is a slave unit, this flag is set (1) upon a request from the master (only if it was a slave request in the locked state from the unit requesting a lock). clear: this flag is cleared (0) if the status trans mission interrupt, communication end interrupt, frame end interrupt, or intie1 interrupt request signal is generated. (c) status transmission flag (statusf)...bit 4 a flag that indicates the master requested transmission of the slave status and lock address (higher 4 bits and lower 8 bits) when the controller was serving as a slave. set: this flag is set (1) when 0h, 4h, 5h, or 6h is re ceived in the control field from the master when the iebus is a slave unit. clear: this flag is cleared (0) if the start interr upt, communication end interrupt, frame end interrupt, or intie1 interrupt request signal is generated. (d) communication end flag (endtrans)...bit 3 a flag that indicates whether communication ends afte r the number of bytes set in the telegraph length field have been transferred. when a communicati on error occurs, the intie2 and intsta interrupt request signals are generated. set: this flag is set (1) when the count value of the scr register is 00h. clear: this flag is cleared (0) if the start interrupt, st atus transmission interrupt, frame end interrupt (if the communication end interrupt does not occur), or intie1 interrupt request signal is generated. (e) frame end flag (endfram)...bit 2 a flag that indicates whether communication ends afte r the maximum number of bytes (mode 1: 32 bytes, mode 2: 128 bytes) have been transferred. set: this flag is set (1) when the count value of the ccr register is 00h. clear: this flag is cleared (0) if the start interru pt, status transmission interrupt, communication end interrupt (if the frame end interrupt does not occur), or intie1 interrupt request signal is generated cautions 1. if both the ccr and scr regist ers are cleared to 00h, the endtrns and endfram bits are set (1) at the same time. 2. if the last data field is the nack si gnal when the maximum number of transmitted bytes is reached as a result of retransmi tting the data, the endfram bit and ieerr (nack reception error) bit are set at the same time.
chapter 18 iebus controller user?s manual u16603ej5v1ud 719 (6) iebus error status register (esr) the esr register indicates the source of the communicati on error interrupt request signal of iebus. each bit of this register is set (1) as soon as the communication er ror flag (isr.ieerr bit) is set (1). the source of a communication error, if any, can be identified by checking the contents of this register. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. after reset: 00h r/w address: fffff365h <7> <6> <5> <4> <3> <2> 1 <0> esr terr perr nerr uerr oerr werr 0 deflag terr timing error occurrence flag 0 timing error did not occur 1 timing error occurred perr parity error occurrence flag 0 parity error did not occur 1 parity error occurred nerr nack reception error occurrence flag 0 nack reception error does not occur 1 nack reception error occurred uerr underrun error occurrence flag 0 underrun error did not occur 1 underrun error occurred oerr overrun error occurrence flag 0 overrun error did not occur 1 overrun error occurred werr write error occurrence flag 0 write error did not occur 1 write error occurred deflag third party error occurrence flag 0 error occurred during communication with unit 1 error occurred during communica tion with station other than unit cautions 1. each bit can only be cleared (0). it cannot be set (1) even if 1 is written to it. 2. the value of the esr register is updated wh en an error occurs. if the esr register is read at this time, however, an undefined value is read. it is recommended to read the esr register in error interrupt servicing. 3. if a communication error occurs, the iebus controller returns to th e default status and makes preparation for communi cation. if communication is started without the error corrected, the error fl ag accumulates the error. corr ect the error before the next communication is started.
chapter 18 iebus controller user?s manual u16603ej5v1ud 720 (a) timing error occurr ence flag (terr)?bit 7 set: this flag is set (1) if a timing error occurs. clear: by software a timing error occurs if the high-/low-level width of the communication bit is not the defined value. the defined value of the high- and low-level width is se t to the bit processing block and monitored by the internal timer. if a timing erro r occurs, the interr and intie2 interrupt request signals are generated. (b) parity error occurr ence flag (perr)?bit 6 set: this flag is set (1) if a parity error occurs. clear: by software a parity error occurs if the parity generated in ea ch field does not match the received parity while the controller is serving as a receiver unit. if the par ity does not match in the data field during individual communication, however, the nack signal is re turned and retransmission of data is requested. therefore, the parity e rror does not occur. table 18-14. operation if parity does not match field communication mode operati on if parity does not match master address field i ndividual/broadcast parity error occurs. slave address field individual/br oadcast parity error occurs. control data field individual/br oadcast parity error occurs. telegraph length field i ndividual/broadcast parity error occurs. individual retransmission is req uested by returning nack signal. data field broadcast parity error occurs. (c) nack reception error occurrence flag (nerr)?bit 5 set: this flag is set (1) if a nack reception error occurs. clear: by software a nack reception error occurs if the nack signal is received during the acknowledge bit period of the slave address field, control data field, or telegraph length field during individual communication, regardless of whether the controller is operati ng as the master or a slave. if the nack signal is received during the acknowledge bit period of the data field, a nack reception error does not occur because data is retransmitted. if the nack signal is received during t he acknowledge period of the last data field when the maximum number of transfer bytes is reached, the nack reception error occurs. the nack reception error does not occur during broa dcast communication because the ack/nack signal is not identified. the nack reception error does not occur during th ird-party communication because only the timing/parity error is detected as an error.
chapter 18 iebus controller user?s manual u16603ej5v1ud 721 (d) underrun error occurrence flag (uerr)?bit 4 set: this flag is set (1) if an underrun error occurs. clear: by software an underrun error occurs if the next data is not tr ansmitted to the dr register in time before the ack signal is received. if the nack signal is received during individual communication and during the acknowledge bit period, the underrun error does not occur because the data is retransmitted. figure 18-13. timing of underrun error occurrence p . . . . . . a data field data field pa request to write data to dr register underrun error occurs if data is not written to dr register during this period. intie1 remark p: parity bit a: acknowledge bit
chapter 18 iebus controller user?s manual u16603ej5v1ud 722 (e) overrun error occurre nce flag (oerr)?bit 3 set: this flag is set (1) if an overrun error occurs. clear: by software if 1-byte data is stored in the dr register while the i ebus controller serves as a receiver unit, the data request interrupt request signal (intie 1) is generated, and the dr register is read by means of dma or by software. if this reading is delayed and the ne xt data is received, an overrun error occurs. cautions 1. if the dr register is not read and the number of retransm itted data reaches the maximum number of transmitted bytes (3 2 bytes) after the overrun error has occurred, the frame end interrupt request signal (intsta or intie2) occurs. the overrun status is maintained until the dr re gister is read, even after the frame has ended. 2. the overrun status is cleared only when the dr register is re ad and when the system is reset. therefore, be sure to read the dr register in the communication error interrupt processing program. 3. the next data cannot be transmitted in th e overrun status if it is 2 bytes or more. because the data request interrupt request signal (intie1) does not occur, the transmit data cannot be set and an underr un error occurs. therefore, be sure to execute transmission after cl earing the overrun status. remark during individual communication reception, the nack signal is returned during the acknowledge bit period of the next data. in response, the transmitter unit retransmits data. therefore, the ccr register is decremented but the scr re gister is not decremented. during broadcast communication reception, t he communication error interrupt request signal (intie2) is generated and recept ion is stopped. at this time, the dr register is not updated. the intie1 signal is not generat ed. the statrx bit of the ssr r egister is held set (to 1). the overrun status is cleared when data is re ceived after the dr register has been read. figure 18-14. timing of overrun error occurrence p . . . . . . a data field data field pa request to write data to dr register overrun error occurs if data is not written to dr register during this period. intie1 remark p: parity bit a: acknowledge bit
chapter 18 iebus controller user?s manual u16603ej5v1ud 723 (f) write error occurrenc e flag (werr)?bit 2 set: this flag is set (1) if a write error occurs. clear: by software a write error occurs if the data written to the dr regi ster is not transmitted in the data field during unit transmission. the timing of occurrence of a write error is illustrated below. figure 18-15. timing of write error occurrence . . . . . . data field acknowledge bit write error occurs if data is not written to dr register during this period. approx. 170 ns intie1 cautions 1. even when the we rr bit is set (1), the intie1 interrupt request signal may be generated. 2. if the nack signal is returned, th e werr bit is not set because data is retransmitted. (g) third-party error occu rrence flag (deflag)?bit 0 set: this flag is set (1) if a timing error or par ity error occurs during commu nication regardless of the unit (during communication between third parties). clear: by software caution if an error occurs be fore the third-party communicati on starts even when the slave address field does not match that of the uni t (for example, if the nack signal is received when the received address does not match that of the unit in the slave address field (if the nerr bit is set (1))), the deflag bit is not set (1). remark communication between third parties may ta ke place in the fo llowing two cases. <1> if the received address in the slave address fi eld does not match that of the unit (during individual communication: matching with uar register, during broadcast communication: matching with group or fffh) and if communica tion continues after the ack signal has been received, the unit monitors that communication. <2> if the unit cannot respond to the received control data in the control field during broadcast communication and if communication continues, the unit monitors that communication. for example, this happens when the unit re ceives control data fh from master during broadcast communication but the slave rec eption enable flag of the unit is disabled (bcr.enslvrx bit = 0) (the nack signal is returned and communication ends during individual communication).
chapter 18 iebus controller user?s manual u16603ej5v1ud 724 (7) iebus unit address register (uar) the uar register sets the unit address of an iebus uni t. this register must always be set before starting communication. sets the unit address (12 bits) to bits 11 to 0. this register can be read or written in 16-bit units. reset sets this register to 0000h. uar after reset: 0000h r/w address: fffff366h 0000 caution do not set the uar register while co mmunication is enabled (bcr.eniebus bit = 1). (8) iebus slave address register (sar) during a master request, the value of this register is reflected in the value of the transmit data in the slave address field. the sar register must a lways be set before starting communication. the sar register sets the slave address (12 bits) to bits 11 to 0. this register can be read or written in 16-bit units. reset sets this register to 0000h. sar after reset: 0000h r/w address: fffff368h 0000 caution be sure to set the sar re gister only at th e following timings. ? when the bcr.eniebus bit = 0 ? before the first master request is issued (b efore the bcr.mstrq bit is set to 1) after the eniebus bit is set to 1 ? in case of the eniebus bit = 1 and the mstrq bi t = 0, before the next master request is issued (before the mstrq bit is set to 1) after a communication end/frame end timing (9) iebus partner address register (par) the par register stores the master address value received in the master address field regardless of whether the unit is operating as the master or a slave. if a request ?4h? to read the lock address (lower 8 bits) is received from the master, read the value of this register by software, and write the data of the lower 8 bits to the dr register. if a request ?5h? to read the lock address (higher 4 bits ) is received from the master, read the value of this register by software and write the data of bits 11 to 8 to the higher 4 bits of the dr register. the par register sets the partner address (12 bits) to bits 11 to 0. this register is read-only, in 16-bit units. reset sets this register to 0000h.
chapter 18 iebus controller user?s manual u16603ej5v1ud 725 par after reset: 0000h r address: fffff36ah 0000 caution the par register stores an address value if the parity is correct and the unit is not locked when the parity period of the m aster address field expires. if the par register is read at this time, an undefined value is read. (10) iebus receive slave address register (rsa) the rsa register stores the slave a ddress value received in the slave address field regardless of whether the unit is operating as the master or a slave. this register is read-only, in 16-bit units. reset sets this register to 0000h. rsa after reset: 0000h r address: fffff36ch 0000 caution the rsa register stores an address value if the parity is correct and the unit is not locked when the parity period of the slave address field expires. if th e rsa register is read at this time, an undefined value is read. (11) iebus control data register (cdr) the cdr register can be read or written in 8-bit units. reset sets this register to 00h. remark the cdr register consists of a write register and a read regist er and data written to the cdr register cannot be read as is. the data read fr om this register is the data received by iebus communication. (a) when master unit the data of the lower 4 bits is refl ected in the data transmi tted in the control field. during a master request, the cdr register must be set in advance before starting communication. (b) when slave unit the data received in the control field is written to the lower 4 bits. when the status transmission flag (isr.statusf bit) is set (1), an interrupt request signal (intie2) is issued, and each processing should be performed by softw are, according to the value of the lower 4 bits of the cdr register.
chapter 18 iebus controller user?s manual u16603ej5v1ud 726 after reset: 00h r/w address: fffff36eh 7 6 5 4 3 2 1 0 cdr 0 0 0 0 mod selcl2 selcl1 selcl0 mod selcl2 selcl1 selcl0 function 0 0 0 0 read slave status 0 0 0 1 undefined 0 0 1 0 undefined 0 0 1 1 read data and lock 0 1 0 0 read lock address (lower 8 bits) 0 1 0 1 read lock address (lower 4 bits) 0 1 1 0 read slave status and unlock 0 1 1 1 read data 1 0 0 0 undefined 1 0 0 1 undefined 1 0 1 0 write command and lock 1 0 1 1 write data and lock 1 1 0 0 undefined 1 1 0 1 undefined 1 1 1 0 write command 1 1 1 1 write data cautions 1. because the slave uni t must judge whether the recei ved data is a ?command? or ?data?, read the value of the cdr regi ster after completing communication. 2. if the master unit sets an undefine d value, the slave unit returns the nack signal and communication is aborted. during br oadcast communication, the master unit ignores the acknowledge bit and continues communication. therefore, do not set an undefined value.
chapter 18 iebus controller user?s manual u16603ej5v1ud 727 (c) slave status return operation when iebus receives a request to transfer from master to slave status or a lock address request (control data: 0h, 6h), whether the ack/nack signal in the control field is retu rned or not depends on the status of the iebus unit. (1) if 0h or 6h control data was received in the unlocked state ack signal returned (2) if 4h or 5h control data was received in the unlocked state nack signal returned (3) if 0h, 4h, 5h or 6h control data was received in the locked state from the unit t hat sent the lock request ack signal returned (4) if 0h, 4h, or 5h control data was received in the locked state from other than the unit that sent the lock request ack signal returned (5) if 6h control data was received in the locked state from other than the unit that sent the lock request nack signal returned in all of the above cases, the acknowledgment of a slave status or lock request will cause the statusf bit to be set (1) and the status interrupt signal (intie 2, intsta) to be generated. the generation timing is at the end of the control field parity bit (at the start of the acknowledge bit). however, if nack is returned, a nack receive error is generated after the acknowledge bit, and communication is terminated. figure 18-16. interrupt request signal ge neration timing (for (1), (3), and (4)) intie2, intsta signal set by reception of 0h, 4h, 5h, 6h iebus sequence cleared by software control field telegraph length field statusf bit internal nack flag 0 control bits (4 bits) parity bit (1 bit) acknowledge bit (1 bit) telegraph length bits (8 bits)
chapter 18 iebus controller user?s manual u16603ej5v1ud 728 figure 18-17. interrupt request signa l generation timing (for (2) and (5)) intie2 intsta interr set by reception of 0h, 4h, 5h, 6h iebus sequence cleared by software set by detection of nack signal control field statusf bit internal nack flag control bit (4 bits) parity bit (1 bit) acknowledge bit (1 bit) terminated by communication error because in (4) and (5) the communication was from ot her than the unit that sent the lock request while iebus was in the locked state, the start or communication end interrupt request signals (intie2, intsta) are not generated, even if the iebus unit is the communication targe t. the statusf bit is set (1) and the status interrupt request signals (intie2, intsta) are generated, however, if a slav e status or lock address request is acknowledged. note that even if the same control data is received while iebus is in the locked state, the interrupt generation timing for intie2 and in tsta differs depending on whether the master unit (3) or another unit (4) is requesting the locked state. figure 18-18. timing of intie2 and intsta interrupt request si gnal generation in locked state (for (4) and (5)) intie2, intsta iebus sequence status interrupt start master address (12 + p) broad- cast slave address (12 + p + a) control (4 + p + a) telegraph length note (8 + p + a) data note (8 + p + a) note the telegraph length and data modes are not set in the case of (5) because the nack signal is returned. remark p: parity bit, a: acknowledge bit
chapter 18 iebus controller user?s manual u16603ej5v1ud 729 figure 18-19. timing of intie2 a nd intsta interrupt request signal generation in locked state (for (3)) intie2, intsta iebus sequence status interrupt start master address (12 + p) broad- cast slave address (12 + p + a) control (4 + p + a) telegraph length (8 + p + a) communication end interrupt data (8 + p + a) start interrupt remark p: parity bit, a: acknowledge bit
chapter 18 iebus controller user?s manual u16603ej5v1ud 730 (12) iebus telegraph length register (dlr) the dlr register can be read or written in 8-bit units. reset sets this register to 01h. (a) when transmission unit (master transmission, slave transmission) the data of this register is reflect ed in the data transmitted in the telegraph length field and indicates the number of bytes of the transmit data. the dlr register must be set in advance before transmission. (b) when reception unit (master reception, slave reception) the receive data in the telegraph length field transmitted from the transmission unit is written to this register. remark the dlr register consists of a write register and a read register. consequently, data written to this register cannot be read as is. the data that can be read is the data received during iebus communication. after reset: 01h r/w address: fffff36fh 7 6 5 4 3 2 1 0 dlr bit 7 6 5 4 3 2 1 0 setting value remaining number of communication data bytes 0 0 0 0 0 0 0 1 01h 1 byte 0 0 0 0 0 0 1 0 02h 2 bytes : : : : : : : : : : 0 0 1 0 0 0 0 0 20h 32 bytes : : : : : : : : : : 1 1 1 1 1 1 1 1 ffh 255 bytes 0 0 0 0 0 0 0 0 00h 256 bytes cautions 1. when the master is sues a request (0h, 4h, 5h, or 6h) for transmission of a slave status or a lock address (higher 4 bits a nd lower 8 bits), 01h is transmitted as the telegraph length regardless of the contents of the dlr regi ster. it is therefore not necessary to set the dlr register by software. 2. when the iebus controller serves as a receiver unit, the dlr register stores a telegraph length if the value of the parity bi t of the telegraph lengt h field is correct. if the dlr register is read at th is time, an undefined value is read.
chapter 18 iebus controller user?s manual u16603ej5v1ud 731 (13) iebus data register (dr) the dr register sets the communication data (8 bits) to bits 7 to 0. this register can be read or written in 8-bit units. reset sets this register to 00h. remark the dr register consists of a wr ite register and a read register. c onsequently, data written to this register cannot be read as is. the data that can be read is the data received during iebus communication. (a) when transmission unit the data (1 byte) written to the dr r egister is stored in the transmit shi ft register of the iebus interface block. it is then output from the most significant bit, and an interrupt request signal (intie1) is generated each time 1 byte has been transmitted. if the nack signal is received after 1-byte data has been transferred during individual transfer, data is not trans ferred from the dr register to the transmit shift register, and the same data is retransmitted. at this time, intie1 signal is not generated. intie1 signal is generated when the transmit shift regist er stores the dr register value. however, when the last byte and 32nd byte (the last byte of 1 communi cation frame) is stored in the transmit shift register, the intie1 signal is not generated. (b) when reception unit one byte of the data received by t he receive shift register of the iebu s interface block is stored in this register. each time 1 byte has been correctly receiv ed, an interrupt request signal (intie1) is generated. when transmit/receive data is transferred to and from the dr register, using dma can reduce the cpu processing load. after reset: 00h r/w address: fffff370h 7 6 5 4 3 2 1 0 dr cautions 1. if the next data is not in time while the transmission unit is set, an underrun occurs, and a communication error interr upt request signal (intie2, interr) occurs, stopping transmission. 2. if data is not read in time before th e next data is read when the iebus controller functions as a receiver unit during indi vidual communication reception, the nack signal is returned by the ack nowledge bit of the data fiel d, requesting the master to retransmit the data. if the dr register is not read after the data has reached the maximum number of transmit bytes, how ever, the frame end interrupt request signal (intie2, intsta) and nack reception e rror interrupt request signal (intie2, interr) are generated at the same time. 3. if data is not read in time before the next data is received when the iebus controller functions as a receiver unit du ring broadcast communication reception, an overrun error occurs and the comm unication error interrupt request signal (intie2, interr) is generated. 4. when the iebus controller serves as a re ceiver unit, the dr register stores receive data if the value of the parity bit of the da ta field is correct. if the dr register is read at this time, an undefined value is read.
chapter 18 iebus controller user?s manual u16603ej5v1ud 732 (14) iebus field status register (fsr) the fsr register stores the status of the field status of the iebus controller if an interrupt request signal (intie1, intie2, intsta, or interr) is generated. this register is read-only, in 8-bit units. reset sets this register to 00h. cautions 1. if an interrupt request signal is generated during communication between third parties, the fsr register is cleared to 00h. how ever, because only an interrupt request signal that is generated if an error occurs is generated during comm unication between third parties, the error can be id entified as that during communi cation between third parties, by reading third-party error flag (esr.deflag bit). 2. the fsr register updates the status info rmation when an interrupt request signal is generated. if the fsr register is read at this time, however, an undefined value is read. 3. if another interrupt request signal is generated befo re the fsr register is read, the status information when the preceding interrupt o ccurred is updated by the status information when the new interrupt occurs. 4. use the fsr register only for problem an alysis; do not use it with the actual software. 0 fsr 0 0 0 00 fstate1 fstate0 after reset: 00h r address: fffff371h 6543210 7 remark for the explanation of the fstate1 and fstate0 bits, see table 18-15 field status . table 18-15. field status explanation field status master/slave field tr ansmission/reception start field master address field slave address field control data field telegraph length field slave transmission status fsr = 00h slave operation data field reception telegraph length field slave transmission status fsr = 01h slave operation data field transmission telegraph length field master reception status fsr = 02h master operation data field reception start field master address field slave address field control data field telegraph length field master transmission status fsr = 03h master operation data field transmission
chapter 18 iebus controller user?s manual u16603ej5v1ud 733 (15) iebus success count register (scr) the scr register indicates the number of remaining communication bytes. the count value of the counter in which the value set by the dlr r egister is decremented by the ack signal in the data field is read from this register. when the count value has reached ?00h?, the communication end flag (isr.endtrns bit) is set (1). this register is read-only, in 8-bit units. reset sets this register to 00h. after reset: 01h r address: fffff372h 7 6 5 4 3 2 1 0 scr bit 7 6 5 4 3 2 1 0 setting value remaining number of communication data bytes 0 0 0 0 0 0 0 1 01h 1 byte 0 0 0 0 0 0 1 0 02h 2 bytes : : : : : : : : : : 0 0 1 0 0 0 0 0 20h 32 bytes : : : : : : : : : : 1 1 1 1 1 1 1 1 ffh 255 bytes 0 0 0 0 0 0 0 0 00h 0 bytes (end of communication) or 256 bytes note note the actual counter consists of 9 bits. when ?00h? is read, it cannot be judged whether the remaining number of communication data bytes is 0 (end of communication) or 256. therefore, either the communication end flag (endtrns bit) is us ed, or if ?00h? is read when the first interrupt occurs at the beginning of communication, the remaining number of communication data bytes is judged to be 256. caution the scr register is updated when the pa rity period of the telegraph field expires and when the ack signal of the data field is received. if the scr register is read at this time, however, an undefined value is read.
chapter 18 iebus controller user?s manual u16603ej5v1ud 734 (16) iebus communication count register (ccr) the ccr register indicates the number of bytes remain ing from the communication byte number specified by the communication mode. this register indicates the number of transfer bytes. the maximum number of transmitted bytes per frame de fined in each mode (mode 1: 32 bytes, mode 2: 128 bytes) is preset to this register. the count value of the co unter that is decremented during the acknowledge bit period of the data field regardless of the ack/nack signal is read from this register. whereas the scr register is decremented during normal communication (a ck signal), the ccr register is decremented when 1 byte has been communicated, regardless of whether the signal is ack or nack. when the count value has reached ?00h?, the frame end flag (isr.endfram bit) is set (1). the preset value of the maximum num ber of transmitted bytes per frame is 20h (32 bytes) in mode 1 and 80h (128 bytes) in mode 2. this register is read-only, in 8-bit units. reset input sets this register to 20h. after reset: 20h r address: fffff373h 7 6 5 4 3 2 1 0 ccr caution the maximum number of transm it bytes is preset to the ccr register when the start bit is transmitted or received, and the register is d ecremented when the parity period of the data field expires. if the ccr register is read at this time, however, an und efined value is read.
chapter 18 iebus controller user?s manual u16603ej5v1ud 735 (17) iebus clock select register (ocks2) the ocks2 register selects the clock of iebus. the main clock frequencies that can be used are shown below. no other main clock frequencies can be used. this register can be read or written in 8-bit units. reset input clears this register to 00h. ? 6.0 mhz/6.291456 mhz (6.29 mhz) ? 12.0 mhz/12.582912 mhz (12.58 mhz) ? 18.0 mhz/18.874368 mhz (18.87 mhz) ? 24.0 mhz/25.165824 mhz (25.16 mhz) note ? 30.0 mhz/31.457280 mhz (31.45 mhz) note note v850es/sj2-h only 0 iebus clock operation stops iebus clock operation enabled ocksen2 0 1 iebus clock operation specification ocks2 0 0 ocksen2 ocksth2 0 ocks21 ocks20 f xx /2 (when f xx = 12.0 mhz or f xx = 12.58 mhz) f xx /3 (when f xx = 18.0 mhz or f xx = 18.87 mhz) f xx /4 (when f xx = 24.0 mhz or f xx = 25.16 mhz) note f xx /5 (when f xx = 30.0 mhz or f xx = 31.45 mhz) note f xx (when f xx = 6.0 mhz or f xx = 6.29 mhz) setting prohibited ocksth2 0 0 0 0 1 ocks21 0 0 1 1 0 ocks20 0 1 0 1 0 iebus clock selection after reset: 00h r/w address: fffff348h 6543210 7 other than above note v850es/sj2-h only
chapter 18 iebus controller user?s manual u16603ej5v1ud 736 18.4 interrupt operations of iebus controller 18.4.1 interrupt control block interrupt request signal <1> communication error ieerr (i) timing error: terr (ii) parity error: perr (iii) nack receive error: nerr (iv) underrun error: uerr (v) overrun error: oerr (vi) write error: werr <2> start interrupt startf <3> status communication statusf <4> end of communication endtrns <5> end of frame endfram <6> transmit data write request stattx <7> receive data read request statrx a communication error <1> occurs if any of the above error sources (i) to (vi) is generated. these error sources are assigned to t he error status register (esr) (see table 18-18 communication error source processing list ). the above interrupt signals <1> to <5> ar e assigned to the isr register (see table 18-17 interrupt source list ). the configuration of t he interrupt control block is illustrated below.
chapter 18 iebus controller user?s manual u16603ej5v1ud 737 figure 18-20. configuration of interrupt control block intsta intie1 interr intie2 intc of v850es/sj2, v850es/sj2-h interrupt control block iebus controller startf statusf endtrns endfram stattx statrx terr perr nerr uerr oerr werr cautions 1. the logical sum (or) output of the st atrx and stattx signals is treated as an interrupt request signal (intie1). 2. the logical sum (or) output of the te rr, perr, nerr, uerr, oerr, and werr signals is treated as a communication error (ieerr) or an interrupt request signal (interr). 3. the logical sum (or) output of the st artf, statusf, endtrns, and endfram signals is treated as an interrupt request signal (intsta). 4. the logical sum (or) output of the i eerr, startf, statusf, endtrns, and endfram signals (logical sum (or) output of intsta and interr signals) is treated as an interrupt request signal (intie2).
chapter 18 iebus controller user?s manual u16603ej5v1ud 738 table 18-16. interrupt request signal generation source list interrupt request signal interrupt source symbol intie1 intie2 interr intsta communication error interrupt ieerr timing error terr parity error perr nack reception error nerr underrun error uerr overrun error oerr write error werr start interrupt startf status transmission statusf end of communication endtrns end of frame endfram transmit data write request stattx receive data write request statrx
chapter 18 iebus controller user?s manual u16603ej5v1ud 739 18.4.2 example of identifying interrupt the iebus controller processes interrupts in the following two ways. ? using three interrupt request signals: intie1, interr, and intsta ? using two interrupt request signals: intie1 and intie2 caution mask the interrupt sources that are not used so that the interrupts do not occur. how an interrupt is identified in each of the above cases is explained below. (1) when intie1, interr, a nd intsta signals are used figure 18-21. example of identi fying intie1 signal interrupt (when intie1, interr, and intsta signals are used) transmission write processing intie1 signal generated reception read processing master transmission or slave transmission yes no figure 18 - 22. example of identifying interr signal interrupt (when intie1, interr, and intsta signals are used) interr signal generated esr register teer bit peer bit neer bit ueer bit oeer bit weer bit error source identification
chapter 18 iebus controller user?s manual u16603ej5v1ud 740 figure 18-23. example of identi fying intsta signal interrupt (when intie1, interr, and intsta signals are used) intsta signal generated isr register ssr register startf bit start interrupt occurs cdr register statusf bit endtrns bit communication end identification endfram bit frame end identification status transmission identification status transmission processing arbitration loss detection arbit bit remaster processing 00h, 06h writing ssr register to dr register 04h writing lower 8 bits of par register to dr register 05h writing higher 4 bits of par register to dr register slvrq bit slave request identification (2) when intie1 and in tie2 signals are used figure 18-24. example of identifying intie1 signal in terrupt (when intie1 and intie2 signals are used) transmission write processing intie1 signal generated reception read processing master transmission or slave transmission yes no
chapter 18 iebus controller user?s manual u16603ej5v1ud 741 figure 18-25. example of identifying intie2 signal in terrupt (when intie1 and intie2 signals are used) intie2 signal generated isr register ssr register startf bit ieerr bit start interrupt occurs communication error identification cdr register statusf bit endtrns bit communication end identification endfram bit frame end identification status transmission identification status transmission processing arbitration loss detection arbit bit remaster processing 00h, 06h 04h 05h slvrq bit slave request identification esr register teer bit peer bit neer bit ueer bit oeer bit weer bit error source identification writing ssr register to dr register writing lower 8 bits of par register to dr register writing higher 4 bits of par register to dr register
chapter 18 iebus controller user?s manual u16603ej5v1ud 742 18.4.3 interrupt source list the interrupt request signals of the internal iebus controller in the v850es/sj2 and v850es/sj2-h can be classified into vector interrupts and dma transfer interrupt s. these interrupt request signals can be specified via software manipulation. the interrupt sources are listed below. table 18-17. interrupt source list condition of generation interrupt source unit field software processing after generation of interrupt request signal remark timing error master/slave all fields other than data (individual) parity error reception all fields (broadcast) nack reception reception (transmission) other than data (individual) underrun error transmission data overrun error reception data (broadcast) communication error write error transmission data undo communication processing co mmunication error is logical sum (or) output of timing error, parity error, nack reception error, underrun error, overrun error, and write error. master slave/address slave request judgment arbitration judgment (if lost, remaster processing) communication preparation processing interrupt always occurs if lost in arbitration during master request start interrupt slave slave/address slave request judgment communication preparation processing generated only during slave request status transmission slave control refer to transmission processing example such as slave status. interrupt occurs regardless of slave transmission enable flag interrupt occurs if nack is returned in the control field. transmission data dma transfer end processing end of communication reception data dma transfer end processing receive data processing set if scr register is cleared to 00h transmission data retransmission preparation processing end of frame reception data re-reception preparation processing set if ccr register is cleared to 00h transmit data write transmission data reading of transmit data note set after transfer transmission data to internal shift register this does not occur when the last data is transferred. receive data read reception data reading of received data note set after normal data reception note if dma transfer or software manipulation is not executed.
chapter 18 iebus controller user?s manual u16603ej5v1ud 743 18.4.4 communication error source processing list the following table shows the occurrence conditions of th e communication errors (timing error, nack reception error, overrun error, underrun error, parity error, and write error), error processing by the iebus controller, and examples of processing by software. table 18-18. communication erro r source processing list (1/2) timing error unit status reception transmission occurrence condition if bit specification timing is not correct occurrence condition location of occurrence other than data field data field other than data field data field hardware processing ? reception stops. ? intie2 signal occurs ? to start bit waiting status remark communication between other units does not end. ? transmission stops. ? intie2 signal occurs ? to start bit waiting status broadcast communication software processing ? error processing (such as retransmission request) ? error processing (such as retransmission request) hardware processing ? reception stops. ? intie2 signal occurs ? nack signal is returned. ? to start bit waiting status ? transmission stops. ? intie2 signal occurs ? to start bit waiting status individual communication software processing ? error processing (such as retransmission request) ? error processing (such as retransmission request) nack reception error unit status reception transmission occurrence condition unit nack signal transmission unit nack signal transmission occurrence condition location of occurrence other than data field data field other than data field data field nack signal reception of data of 32nd byte hardware processing ? ? ? ? ? broadcast communication software processing ? ? ? ? ? hardware processing ? reception stops. ? intie2 signal occurs. ? to start bit waiting status ? intie2 signal does not occur. ? data retransmitted by other unit is received. ? reception stops. ? intie2 signal occurs. ? to start bit waiting status ? intie2 signal does not occur. ? retrans- mission processing ? intie2 signal occurs. ? to start bit waiting status individual communication software processing ? error processing (such as retransmission request) ? ? error processing (such as retransmission request) ? ? error processing (such as retransmission request)
chapter 18 iebus controller user?s manual u16603ej5v1ud 744 table 18-18. communication erro r source processing list (2/2) overrun error underrun error/write error unit status reception transmission occurrence condition dr register cannot be read in time before the next data is received. dr register cannot be written in time before the next data is transmitted. occurrence condition location of occurrence other than data field data field other than data field data field hardware processing ? ? reception stops. ? intie2 signal occurs. ? to start bit waiting status remarks 1. communication between other units does not end. 2. data cannot be received until the overrun status is cleared. ? ? transmission stops. ? intie2 signal occurs. ? to start bit waiting status broadcast communication software processing ? ? dr register is read and overrun status is cleared. ? error processing (such as retransmission request) ? ? error processing (such as retransmission request) hardware processing ? ? intie2 signal does not occur. ? nack signal is returned. ? data is retransmitted from other unit. remark data cannot be received until overrun status is cleared. ? ? transmission stops. ? intie2 signal occurs. ? to start bit waiting status individual communication software processing ? ? dr register is read and overrun status is cleared. ? error processing (such as retransmission request) ? ? error processing (such as retransmission request) parity error unit status reception transmission occurrence condition received data and received parity do not match. ? occurrence condition location of occurrence other than data field data field other than data field data field hardware processing ? reception stops. ? intie2 signal occurs. ? to start bit waiting status remark communication between other units does not end. ? ? broadcast communication software processing ? error processing (such as retransmission request) ? ? hardware processing ? reception stops. ? intie2 signal occurs. ? to start bit waiting status ? reception does not stop. ? intie2 signal does not occur. ? nack signal is returned. ? data retransmitted by other unit is received. ? ? individual communication software processing ? error processing (such as retransmission request) ? ? ?
chapter 18 iebus controller user?s manual u16603ej5v1ud 745 18.5 interrupt request signal generati on timing and main cpu processing 18.5.1 master transmission initial preparation processing: sets a unit address, slave address, control data, te legraph length, and the first byte of the transmit data. communication start processing: set the bcr register (enable communica tion, master request, and slave reception). figure 18-26. master transmission start broad- cast m address p s address p a control p a telegraph length p a data 1 pa data 1 data 2 p a data n ? 1 p a data n p a <1> <2> approx. 624 s (mode 1, at 6.29 mhz) approx. 390 s (mode 1, at 6.29 mhz) <1> interrupt request signal (intie2, intsta) occurrence judgment of occurrence of error note error processing judgment of slave request slave reception processing (see 18.5.1 (1) slave reception processing ) judgment of arbitration result remaster request processing <2> interrupt request signal (intie2, intsta) occurrence judgment of occurrence of error note error processing judgment of end of communication end of communication processing judgment of end of frame recommunication processing (see 18.5.1 (3) recommunication processing ) note this processing is necessary only when the intie2 interrupt request signal is used as the start interrupt, and is not necessary when the intsta interrupt request signal is used (in this case, the error processing is performed by using the interr interrupt request signal). remarks 1. : interrupt request signal (intie1) occurrence (see 18.5.1 (2) interr upt request signal (intie1) occurrence ) the transmit data of the sec ond and subsequent bytes is wri tten to the dr register by dma transfer. at this time, the data transfer direction is ram on-chip peripheral i/o 2. : an interrupt request signal (intie1) does not occur. 3. n = final number of data bytes
chapter 18 iebus controller user?s manual u16603ej5v1ud 746 (1) slave reception processing if a slave reception request is confirmed during vector in terrupt servicing, the data transfer direction of the macro service must change from ram on-chip peripheral i/o to on-chip peripheral i/o ram until the first data is received. the maximum pending period of this da ta transfer direction changing processing is about 1,040 s in communication mode 1 (at 6.29 mhz). (2) interrupt request signal (intie1) occurrence if the nack signal is received from the slave in the data field, an interrupt request signal (intie1) is not issued to the interrupt controller (intc), and the same data is retransmitted by hardware. if the transmit data is not written in time during the period of writing the next data, a communication error interrupt request signal (interr) occurs due to o ccurrence of underrun, and communication ends midway. (3) recommunication processing in the vector interrupt servicing in <2> in figure 18-26, it is judged whether the data has been correctly transmitted within one frame. if the data has not been correctly transmitt ed (if the number of data to be transmitted in one frame could not be transmitted), the da ta must be retransmitted in the next frame, or the remainder of the data must be transmitted.
chapter 18 iebus controller user?s manual u16603ej5v1ud 747 18.5.2 master reception before performing master reception, it is necessary to notify the unit that will be the sl ave of slave transmission. therefore, more than two communication fram es are necessary for master reception. the slave unit prepares the transmit data, sets (1) the slave transmission e nable flag (bcr.enslvtx bit), and waits. initial preparation processing: set a unit address, slave address, and control data. communication start processing: set the bcr register (enable communication and master request). figure 18-27. master reception approx. 1,014 s (mode 1, at 6.29 mhz) start broad- cast m address p s address p a control a p telegraph length a p data 1 approx. 390 s (mode 1, at 6.29 mhz) data 1 p a data 2 p a data n ? 1 p a data n p a <2> <1> <1> interrupt request signal (intie2, intsta) occurrence judgment of occurrence of error note error processing judgment of slave request slave processing judgment of arbitration result remaster request processing <2> interrupt request signal (intie2, intsta) occurrence judgment of occurrence of error note error processing judgment of end of communication end of communication processing judgment of end of frame frame end processing (see 18.5.2 (2) frame end processing ) note this processing is necessary only when the intie2 interrupt request signal is used as the start interrupt, and is not necessary when the intsta interrupt request signal is used (in this case, the error processing is performed by using the interr interrupt request signal). remarks 1. : interrupt request signal (intie1) occurrence (see 18.5.2 (1) interr upt request signal (intie1) occurrence ) the receive data stored in the dr register is read by dma transfer. at this time, the data transfer direction is on-chip peripheral i/o ram. 2. n = final number of data bytes
chapter 18 iebus controller user?s manual u16603ej5v1ud 748 (1) interrupt request signal (intie1) occurrence if the nack signal is transmitted (hardwar e processing) in the data field, an interrupt request signal (intie1) is not issued to the intc, and the same dat a is retransmitted from the slave. if the receive data is not read by the time the next dat a is received, the hardware automatically transmits the nack signal. (2) frame end processing in the vector interrupt servicing in <2> in figure 18-27, it is judged whether the data has been correctly received within one frame. if the data has not been correctly received (if the number of data to be received in one frame could not be received), a request to retrans mit the data must be made to the slave in the next communication frame.
chapter 18 iebus controller user?s manual u16603ej5v1ud 749 18.5.3 slave transmission initial preparation processing: set a unit address, telegraph length, and the first byte of the transmit data. communication start processing: set the bcr register (enable communicati on, slave transmission, and slave reception). figure 18-28. slave transmission start m address p s address p a control p a data 1 pa data 1 data 2 p a data n ? 1 p a data n p a <1> <2> pa approx. 390 s (mode 1, at 6.29 mhz) approx. 624 s (mode 1, at 6.29 mhz) broad- cast telegraph length <1> interrupt request signal (intie2, intsta) occurrence judgment of occurrence of error note error processing judgment of slave request <2> interrupt request signal (intie2, intsta) occurrence judgment of occurrence of error note error processing judgment of end of communication end of communication processing judgment of end of frame frame end processing (see 18.5.3 (2) frame end processing ) note this processing is necessary only when the intie2 interrupt request signal is used as the start interrupt, and is not necessary when the intsta interrupt request signal is used (in this case, the error processing is performed by using the interr interrupt request signal). remarks 1. : interrupt request signal (intie1) occurrence (see 18.5.3 (1) interr upt request signal (intie1) occurrence ). the transmit data of the sec ond and subsequent bytes is wri tten to the dr register by dma transfer. at this time, the data transfer direction is ram on-chip peripheral i/o. 2. : an interrupt request signal (intie1) does not occur. 3. : interrupt request signal (intie2) occurrence an interrupt request signal occurs only when 0h, 4h, 5h, or 6h is received in the control field in the slave status (for t he slave status response operatio n during the locked status, see 18.3 (11) iebus control data register (cdr) ). 4. n = final number of data bytes
chapter 18 iebus controller user?s manual u16603ej5v1ud 750 (1) interrupt request signal (intie1) occurrence if the nack signal is received from the master in the data field, an interrupt request signal (intie1) is not issued to the intc, and the same dat a is retransmitted by hardware. if the transmit data is not written in time during the period of writing the next data, a communication error interrupt request signal (interr) occurs due to occurrence of underrun, and communication is abnormally ended. (2) frame end processing in the vector interrupt servicing in <2> in figure 18-28, it is judged whether the data has been correctly transmitted within one frame. if the data has not been correctly transmitt ed (if the number of data to be transmitted in one frame could not be transmitted), the da ta must be retransmitted in the next frame, or the remaining data must be transmitted.
chapter 18 iebus controller user?s manual u16603ej5v1ud 751 18.5.4 slave reception initial preparation processing: set a unit address. communication start processing: set the bcr register (enable communication, disa bles slave transmission, and enables slave reception). figure 18-29. slave reception start m address p s address p a control p a data 1 pa data 1 data 2 p a data n ? 1 p a data n p a <1> pa <2> approx. 390 s (mode 1, at 6.29 mhz) approx. 1,014 s (mode 1, at 6.29 mhz) broad- cast telegraph length <1> interrupt request signal (intie2, intsta) occurrence judgment of occurrence of error note error processing judgment of slave request slave processing <2> interrupt request signal (intie2, intsta) occurrence judgment of occurrence of error note error processing judgment of end of communication end of communication processing judgment of end of frame frame end processing (see 18.5.4 (2) frame end processing ). note this processing is necessary only when the intie2 interrupt request signal is used as the start interrupt, and is not necessary when the intsta interrupt request signal is used (in this case, the error processing is performed by using the interr interrupt request signal). remarks 1. : interrupt request signal (intie1) occurrence (see 18.5.4 (1) interr upt request signal (intie1) occurrence ). the receive data stored in the dr register is read by dma transfer. at this time, the data transfer direction is on-chip peripheral i/o ram. 2. n = final number of data bytes
chapter 18 iebus controller user?s manual u16603ej5v1ud 752 (1) interrupt request signal (intie1) occurrence if the nack signal is transmitted in the data field, an in terrupt request signal (intie1) is not issued to the intc, and the same data is retransmitted from the master. if the receive data is not read by the time the next data is received, the nack signal is automatically transmitted. (2) frame end processing in the vector interrupt servicing in <2> in figure 18-29, it is judged whether the data has been correctly received within one frame.
chapter 18 iebus controller user?s manual u16603ej5v1ud 753 18.5.5 interval of occurre nce of interrupt request signal for iebus control each control interrupt request signal must occur at each point of communication and perform the necessary processing until the next interrupt request signal occurs. t herefore, the iebus control blo ck is controlled by software, taking the shortest time of this interrupt reques t signal occurrence interval into consideration. the locations at which the following interrupt request signals may occur are indicated by in the field where it may occur. does not mean that the interrupt request signal occurs at each of the points indicated by . if an error interrupt request signal (timing error, parit y error, or nack receive error) occurs, the iebus internal circuit is initialized. as a result, the following interrupt request signal does not occur in that communication frame. (1) master transmission figure 18-30. master transmission (interval of interrupt request signal occurrence) start bit t t1 t broad- cast master address t t2 p slave address t pa at t t3 control p a a t4 tat telegraph length p a data p a communication starts communication start interrupt pa data data a p data tt t4 end of communication end of frame u u t5 a remarks 1. t: timing error a: nack receive error u: underrun error : data set interrupt (intie1) 2. end of frame occurs at the end of 32-byte data. values in parentheses indicate mi n. value (iebus: mode 1, at 6.29 mhz). t1: communication starts timing error (approx. 93 s) t2: communication starts communication start interrupt (approx. 1,282 s) t3: communication start interrupt timing error (approx. 15 s) t4: communication start interrupt end of communication (approx. 1,012 s) t5: transmission data request interrupt interval (approx. 375 s)
chapter 18 iebus controller user?s manual u16603ej5v1ud 754 (2) master reception figure 18-31. master reception (interval of interrupt request signal occurrence) pa pa pa pa pa p a data data data p t1 t communication starts start bit broad- cast master address slave address control telegraph length data tt a end of communication end of frame communication start interrupt tt t t t at t4 t4 t5 t2 a p t a t3 remarks 1. t: timing error p: parity error a: nack receive error : data set interrupt request signal (intie1) 2. end of frame occurs at the end of 32-byte data. values in parentheses indicate mi n. value (iebus: mode 1, at 6.29 mhz). t1: communication starts timing error (approx. 93 s) t2: communication starts communication start interrupt (approx. 1,282 s) t3: communication start interrupt timing error (approx. 15 s) t4: communication start interrupt end of communication (approx. 1,012 s) t5: receive data read interval (approx. 375 s)
chapter 18 iebus controller user?s manual u16603ej5v1ud 755 (3) slave transmission figure 18-32. slave transmission (interval of interrupt request signal occurrence) pa pa pa pa pa pa p t1 t tt u u tt t p p t t tt at t5 t4 t3 t6 t7 t7 t2 a p a communication starts end of communication end of frame communication start interrupt status request data data data start bit broad- cast master address slave address control data telegraph length remarks 1. t: timing error p: parity error a: nack receive error u: underrun error : data set interrupt (intie1) 2. end of frame occurs at the end of 32-byte data. values in parentheses indicate mi n. value (iebus: mode 1, at 6.29 mhz). t1: communication starts timing error (approx. 196 s) t2: communication starts communication start interrupt (approx. 1,192 s) t3: communication start interrupt timing error (approx. 15 s) t4: communication start interrupt status request (approx. 225 s) t5: transmission data request interrupt interval (approx. 375 s) t6: status request timing error (approx. 15 s) t7: status request end of communication (approx. 787 s)
chapter 18 iebus controller user?s manual u16603ej5v1ud 756 (4) slave reception figure 18-33. slave reception (interval of interrupt request signal occurrence) pa pa pa pa pa p a p t1 t tt tt t p p tt at t4 t4 t5 t2 p a pt a t3 p o a p o p start bit data data data end of communication end of frame communication start interrupt communication starts broad- cast master address slave address control data telegraph length remarks 1. t: timing error p: parity error a: nack receive error o: overrun error : data set interrupt (intie1) 2. end of frame occurs at the end of 32-byte data. values in parentheses indicate mi n. value (iebus: mode 1, at 6.29 mhz). t1: communication starts timing error (approx. 196 s) t2: communication starts communication start interrupt (approx. 1,192 s) t3: communication start interrupt timing error (approx. 15 s) t4: communication start interrupt end of communication (approx. 1,012 s) t5: receive data read interval (approx. 375 s)
user?s manual u16603ej5v1ud 757 chapter 19 can controller caution the can controller is allocated in the programmable peripheral i/o area. before using the can controller, enable use of the programmable periphe ral i/o area by using the bpc register. for details, see 3.4.7 progra mmable peripheral i/o registers. 19.1 overview the v850es/sj2 and v850es/sj2- h feature an on-chip 1-channel can (contro ller area network) controller that complies with the can protocol as standardized in iso 11898. the v850es/sj2 and v850es/sj2-h pr oducts with an on-chip can controller are as follows. ? pd703284, 703284y, 70f3284, 70f3284y, 703285, 70 3285y, 703286, 703286y, 70f3286, 70f3286y, 703287, 703287y, 703288, 703288y , 70f3288, 70f3288y, 703285hy, 703286hy, 703287hy, 703288hy, 70f3286hy, 70f3288hy the v850es/sj2 and v850es/sj2-h pro ducts with an on-chip 2-channel can controller are as follows. ? pd703287, 703287y, 703288, 703288y, 70f3288, 70f3288y, 703287hy, 703288hy, 70f3288hy 19.1.1 features ? compliant with iso 11898 and tested according to iso/dis 16845 (can conformance test) ? standard frame and extended fram e transmission/reception enabled ? transfer rate: 1 mbps max. (can clock input 8 mhz) ? 32 message buffers/channels ? receive/transmit history list function ? automatic block transmission function ? multi-buffer receive block function ? mask setting of four patterns is possible for each channel
chapter 19 can controller user?s manual u16603ej5v1ud 758 19.1.2 overview of functions table 19-1 presents an overview of the can controller functions. table 19-1. overview of functions function details protocol can protocol iso 11898 (standard and extended frame transmission/reception) baud rate maximum 1 mbps (can clock input 8 mhz) data storage storing messages in the can ram number of messages ? 32 message buffers/channels ? each message buffer can be set to be either a transmit message buffer or a receive message buffer. message reception ? unique id can be set to each message buffer. ? mask setting of four patterns is possible for each channel. ? a reception completion interrupt is generated each time a message is received and stored in a message buffer. ? two or more receive message buffers can be used as a fifo receive buffer (multi-buffer receive block function). ? receive history list function message transmission ? unique id can be set to each message buffer. ? transmit completion interrupt for each message buffer ? message buffer numbers 0 to 7 specified as transmit message buffers can be used for automatic block transfer. message transmis sion interval is programmable (automatic block transmission function (herea fter referred to as ?abt?)). ? transmission history list function remote frame processing remote frame processing by transmit message buffer time stamp function ? the time stamp function can be set for a re ceive message when a 16-bit timer is used in combination. ? the time stamp capture trigger can be se lected (sof or eof in a can message frame can be detected). diagnostic function ? readable error counters ? ?valid protocol operation flag? for verification of bus connections ? receive-only mode ? single-shot mode ? can protocol error type decoding ? self-test mode release from bus-off state ? can be forcibly released from bus-off by so ftware (timing restrictions are ignored). ? cannot be automatically released from bus-o ff (release request by software is required). power save mode ? can sleep mode (can be woken up by can bus) ? can stop mode (cannot be woken up by can bus)
chapter 19 can controller user?s manual u16603ej5v1ud 759 19.1.3 configuration the can controller is composed of the following four blocks. (1) npb interface this functional block provides an npb (nec periph eral i/o bus) interface and means of transmitting and receiving signals between the can module and the host cpu. (2) mcm (memory control module) this functional block controls access to the can prot ocol layer and to the can ram within the can module. (3) can protocol layer this functional block is involved in the oper ation of the can protocol and its related settings. (4) can ram this is the can memory functional block, which is used to store message ids, message data, etc. figure 19-1. block diagram of can module ctxdn crxdn cpu can module can ram npb (nec peripheral i/o bus) mcm (memory control module) npb interface interrupt request intcntrx intcnrec intcnerr intcnwup can protocol layer can transceiver message buffer 0 message buffer 1 message buffer 2 message buffer 3 message buffer 31 cnmask1 cnmask2 cnmask3 cnmask4 ... can_hn can_ln can bus tsout remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 760 19.2 can protocol can (controller area network) is a high-speed multiplex communication protocol for real-time communication in automotive applications (class c). can is prescribed by iso 11898. for details, refer to the iso 11898 specifications. the can specification is generally divided into two layers: a physical layer and a data link layer. in turn, the data link layer includes logical link and medium access control. the composition of these layers is illustrated below. figure 19-2. composition of layers physical layer prescription of signal level and bit description data link layer note logical link control (llc) medium access control (mac) acceptance filtering overload report recovery management data capsuled/not capsuled frame coding (stuffing/no stuffing) medium access management error detection error report acknowledgment seriated/not seriated higher lower note can controller specification 19.2.1 frame format (1) standard format frame ? the standard format frame uses 11-bit identifiers, wh ich means that it can handle up to 2,048 messages. (2) extended format frame ? the extended format frame uses 29-bit (11 bits + 18 bits) identifiers, which increases the number of messages that can be handled to 2,048 2 18 messages. ? an extended format frame is set when ?recessive level? (cmos level of ?1?) is set for both the srr and ide bits in the arbitration field.
chapter 19 can controller user?s manual u16603ej5v1ud 761 19.2.2 frame types the following four types of frames are used in the can protocol. table 19-2. frame types frame type description data frame frame used to transmit data remote frame frame used to request a data frame error frame frame used to report error detection overload frame frame used to delay the next data frame or remote frame (1) bus value the bus values are divided into dominant and recessive. ? dominant level is indicated by logical 0. ? recessive level is indicated by logical 1. ? when a dominant level and a recessive level are transmitted simultaneously, the bus value becomes dominant level. 19.2.3 data frame and remote frame (1) data frame a data frame is composed of seven fields. figure 19-3. data frame r d interframe space end of frame (eof) ack field crc field data field control field arbitration field start of frame (sof) data frame <1> <2> <3> <4> <5> <6> <7> <8> remark d: dominant = 0 r: recessive = 1
chapter 19 can controller user?s manual u16603ej5v1ud 762 (2) remote frame a remote frame is composed of six fields. figure 19-4. remote frame r d interframe space end of frame (eof) ack field crc field control field arbitration field start of frame (sof) remote frame <1> <2> <3> <5> <6> <7> <8> remarks 1. the data field is not transferred even if the cont rol field?s data length code is not ?0000b?. 2. d: dominant = 0 r: recessive = 1 (3) description of fields <1> start of frame (sof) the start of frame field is located at t he start of a data frame or remote frame. figure 19-5. start of frame (sof) r d 1 bit start of frame (interframe space or bus idle) (arbitration field) remark d: dominant = 0 r: recessive = 1 ? if a dominant level is detected in the bus idle st ate, a hardware synchronization is performed (the current tq is assigned to be the sync segment). ? if a dominant level is sampled at the sample point following such a hardware synchronization, the bit is assigned to be a sof. if a recessive level is de tected, the protocol layer returns to the bus idle state and regards the preceding domin ant pulse as a noise only. in this case an error frame is not generated.
chapter 19 can controller user?s manual u16603ej5v1ud 763 <2> arbitration field the arbitration field is used to set the priori ty, data frame/remote frame, and frame format. figure 19-6. arbitration field (in standard format mode) r d ide (r1) r0 rtr identifier arbitration field (control field) (11 bits) id28 id18 (1 bit) (1 bit) cautions 1. id28 to id18 are identifiers. 2. an identifier is transmitted msb first. remark d: dominant = 0 r: recessive = 1 figure 19-7. arbitration field (in extended format mode) r d r1 r0 rtr ide srr identifier identifier arbitration field (control field) (11 bits) (18 bits) id28 id18 id17 id0 (1 bit) (1 bit) (1 bit) cautions 1. id28 to id18 are identifiers. 2. an identifier is transmitted msb first. remark d: dominant = 0 r: recessive = 1 table 19-3. rtr frame settings frame type rtr bit data frame 0 (d) remote frame 1 (r) table 19-4. frame format setting (ide bit) and number of identifier (id) bits frame format srr bit ide bit number of bits standard format mode none 0 (d) 11 bits extended format mode 1 (r) 1 (r) 29 bits
chapter 19 can controller user?s manual u16603ej5v1ud 764 <3> control field the control field sets ?dlc? as the number of dat a bytes in the data field (dlc = 0 to 8). figure 19-8. control field r d r1 (ide) r0 rtr dlc2 dlc3 dlc1 dlc0 control field (data field) (arbitration field) remark d: dominant = 0 r: recessive = 1 in a standard format frame, the control fiel d?s ide bit is the same as the r1 bit. table 19-5. data length setting data length code dlc3 dlc2 dlc1 dlc0 data byte count 0 0 0 0 0 bytes 0 0 0 1 1 byte 0 0 1 0 2 bytes 0 0 1 1 3 bytes 0 1 0 0 4 bytes 0 1 0 1 5 bytes 0 1 1 0 6 bytes 0 1 1 1 7 bytes 1 0 0 0 8 bytes other than above 8 bytes regardless of the value of dlc3 to dlc0 caution in the remote frame, there is no data field even if the data length code is not 0000b.
chapter 19 can controller user?s manual u16603ej5v1ud 765 <4> data field the data field contains the amount of dat a (byte units) set by the control fi eld. up to 8 units of data can be set. figure 19-9. data field r d data 0 (8 bits) msb lsb data 7 (8 bits) msb lsb data field (crc field) (control field) remark d: dominant = 0 r: recessive = 1 <5> crc field the crc field is a 16-bit field that is used to check for errors in transmit data. figure 19-10. crc field r d crc sequence crc delimiter (1 bit) (15 bits) crc field (ack field) (data field or control field) remark d: dominant = 0 r: recessive = 1 ? the polynomial p(x) used to generate the 15-bi t crc sequence is expressed as follows. p(x) = x 15 + x 14 + x 10 + x 8 + x 7 + x 4 + x 3 + 1 ? transmitting node: transmits the crc sequence calculat ed from the data (before bit stuffing) in the start of frame, arbitration fiel d, control field, and data field. ? receiving node: compares the crc sequence ca lculated using data bits that exclude the stuffing bits in the receive data with the crc sequence in the crc field. if the two crc sequences do not match, the node issues an error frame.
chapter 19 can controller user?s manual u16603ej5v1ud 766 <6> ack field the ack field is used to acknowledge normal reception. figure 19-11. ack field r d ack slot (1 bit) ack delimiter (1 bit) ack field (end of frame) (crc field) remark d: dominant = 0 r: recessive = 1 ? if no crc error is detected, the receiving node sets the ack slot to the dominant level. ? the transmitting node outputs two recessive-level bits. <7> end of frame (eof) the end of frame field indicates the end of data frame/remote frame. figure 19-12. end of frame (eof) r d end of frame (7 bits) (interframe space or overload frame) (ack field) remark d: dominant = 0 r: recessive = 1
chapter 19 can controller user?s manual u16603ej5v1ud 767 <8> interframe space the interframe space is inserted after a data frame, remote frame, error frame, or overload frame to separate one frame from the next. ? the bus state differs dep ending on the error status. (a) error active node the interframe space consists of a 3-bit intermission field and a bus idle field. figure 19-13. interframe space (error active node) r d interframe space intermission (3 bits) bus idle (0 to bits) (frame) (frame) remarks 1. bus idle: state in which the bus is not used by any node. 2. d: dominant = 0 r: recessive = 1 (b) error passive node the interframe space consists of an intermission fi eld, a suspend transmission field, and a bus idle field. figure 19-14. interframe space (error passive node) r d interframe space intermission (3 bits) suspend transmission (8 bits) bus idle (0 to bits) (frame) (frame) remarks 1. bus idle: state in which the bus is not used by any node. suspend transmission: sequence of 8 re cessive-level bits transmitted from the node in the error passive status. 2. d: dominant = 0 r: recessive = 1 usually, the intermission field is 3 bits. if the transmitting node detects a dominant level at the third bit of the intermission field, ho wever, it executes transmission. ? operation in error status table 19-6. operation in error status error status operation error active a node in this status can transmit immediately after a 3-bit intermission. error passive a node in this status can transmit 8 bits after the intermission.
chapter 19 can controller user?s manual u16603ej5v1ud 768 19.2.4 error frame an error frame is output by a node that has detected an error. figure 19-15. error frame <1> r d <2> <3> 6 bits 0 to 6 bits 8 bits (<4>) (<5>) interframe space or overload frame error delimiter error flag 2 error flag 1 error bit error frame remark d: dominant = 0 r: recessive = 1 table 19-7. definition of error frame fields no. name bit count definition <1> error flag 1 6 error active node: outputs 6 domin ant-level bits consecutively. error passive node: outputs 6 rece ssive-level bits consecutively. if another node outputs a dominant level while one node is outputting a passive error flag, the passive error flag is not cleared until the same level is detected 6 bits in a row. <2> error flag 2 0 to 6 nodes receiving error flag 1 detect bit stuff errors and issues this error flag. <3> error delimiter 8 outputs 8 recessive-level bits consecutively. if a dominant level is detected at the 8th bit, an overload frame is transmitted from the next bit. <4> error bit ? the bit at which the error was detected. the error flag is output from the bit next to the error bit. in the case of a crc error, this bit is output following the ack delimiter. <5> interframe space/overload frame ? an interframe space or overload frame starts from here.
chapter 19 can controller user?s manual u16603ej5v1ud 769 19.2.5 overload frame an overload frame is transmitted under the following conditions. ? when the receiving node has not co mpleted the reception operation note ? if a dominant level is detected at the first two bits during intermission ? if a dominant level is detected at the last bit (7th bit) of the end of frame or at the last bit (8th bit) of the error delimiter/overload delimiter note in this can controller, all receive frames can be loaded without outputting an overload frame because of the enough high-speed internal processing. figure 19-16. overload frame <1> r d <2> <3> 6 bits 0 to 6 bits 8 bits (<4>) (<5>) interframe space or overload frame overload delimiter overload flag (node n) overload flag (node m) frame overload frame remark d: dominant = 0 r: recessive = 1 node n node m table 19-8. definition of overload frame fields no name bit count definition <1> overload flag 6 outputs 6 domin ant-level bits consecutively. <2> overload flag from other node 0 to 6 the node that received an overload flag in the interframe space outputs an overload flag. <3> overload delimiter 8 outputs 8 recessive-level bits consecutively. if a dominant level is detected at the 8th bit, an overload frame is transmitted from the next bit. <4> frame ? output following an end of frame, error delimiter, or overload delimiter. <5> interframe space/overload frame ? an interframe space or overload frame starts from here.
chapter 19 can controller user?s manual u16603ej5v1ud 770 19.3 functions 19.3.1 determining bus priority (1) when a node starts transmission: during bus idle, the node that output data first transmits the data. (2) when more than one n ode starts transmission: the node that consecutively outputs the dominant level for the longest from the first bit of the arbitration field has the bus priority (if a dominant level and a recessi ve level are simultaneously transmitted, the dominant level is taken as the bus value). the transmitting node compares its output arbi tration field and the data level on the bus. table 19-9. determining bus priority level match continuous transmission level mismatch continuous transmission (3) priority of data frame and remote frame when a data frame and a remote frame are on the bus, t he data frame has priority because its rtr bit, the last bit in the arbitration field, carries a dominant level. remark if the extended-format data frame and the standard- format remote frame conf lict on the bus (if id28 to id18 of both of them are the same), the standard-format remote frame takes priority. 19.3.2 bit stuffing bit stuffing is used to establish synchronization by appending 1 bit of inverted-level data if the same level continues for 5 bits, in order to prevent a burst error. table 19-10. bit stuffing transmission during the transmission of a data frame or remote frame, when the same level continues for 5 bits in the data between the start of frame and the ack field, 1 inverted-level bit of data is inserted before the following bit. reception during the reception of a data frame or remote frame, when the same level continues for 5 bits in the data between the start of frame and the ack field, re ception is continued after deleting the next bit. 19.3.3 multi masters as the bus priority (a node which acquires transmission rights) is determined by the identifier, any node can be the bus master. 19.3.4 multi cast although there is one transmitting node, two or more node s can receive the same data at the same time because the same identifier can be set to two or more nodes.
chapter 19 can controller user?s manual u16603ej5v1ud 771 19.3.5 can sleep mode/can stop mode function the can sleep mode/can stop mode function puts the can controller in waiting mode to achieve low power consumption. the controller is woken up from the can sleep mode by bus operation but it is not woken up from the can stop mode by bus operation (the can stop mode is controlled by cpu access). 19.3.6 error control function (1) error types table 19-11. error types description of error detection state type detection method detection condition transmission/ reception field/frame bit error comparison of the output level and level on the bus mismatch of levels transmitting/ receiving node bit that is outputting data on the bus at the start of frame to end of frame, error frame and overload frame. stuff error check of the receive data at the stuff bit 6 consecutive bits of the same output level receiving node start of frame to crc sequence crc error comparison of the crc sequence generated from the receive data and the received crc sequence mismatch of crc receiving node crc field form error field/frame check of the fixed format detection of fixed format violation receiving node ? crc delimiter ? ack field ? end of frame ? error frame ? overload frame ack error check of the ack slot by the transmitting node detection of recessive level in ack slot transmitting node ack slot (2) output timing of error frame table 19-12. output timing of error frame type output timing bit error, stuff error, form error, ack error error frame output is started at the timing of the bit following the detected error. cec error error frame output is started at the timing of the bit following the ack delimiter. (3) processing in case of error the transmission node re-transmits the data frame or remo te frame after the error frame. (however, it does not re-transmit the frame in the single-shot mode.)
chapter 19 can controller user?s manual u16603ej5v1ud 772 (4) error state (a) types of error states the following three types of error states are defined by the can specification. ? error active ? error passive ? bus-off these types of error states are classified by the values of the cnerc.tec7 to cnerc.tec0 bits (transmission error counter bits) and the cnerc.rec6 to cnerc.rec0 bits (reception error counter bits) as shown in table 19-13. the present error state is indi cated by the cninfo register. when each error counter value becomes equal to or greater than the error warning level (96), the cninfo.tecs0 or cninfo.recs0 bit is set to 1. in this case, the bus state must be tested because it is considered that the bus has a serious fault. an error counter value of 128 or more indicates an error passive state and the tecs1 or recs1 bit is set to 1. ? if the value of the transmission error counter is gr eater than or equal to 256 (actually, the transmission error counter does not indicate a value greater than or equal to 256), the bus-off state is reached and the cninfo.boff bit is set to 1. ? if only one node is active on the bus at startup (i.e., when the bus is connected only to the local station), ack is not returned even if data is transmitted. c onsequently, re-transmission of the error frame and data is repeated. in the error passive state, howev er, the transmission error counter is not incremented and the bus-off state is not reached. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 773 table 19-13. types of error states type operation value of error counter indication of cninfo register operation specific to error state transmission 0 to 95 tecs1, tecs0 = 00 reception 0 to 95 recs1, recs0 = 00 transmission 96 to 127 tecs1, tecs0 = 01 error active reception 96 to 127 recs1, recs0 = 01 ? outputs an active error flag (6 consecutive dominant- level bits) on detection of the error. transmission 128 to 255 tecs1, tecs0 = 11 error passive reception 128 or more recs1, recs0 = 11 ? outputs a passive error flag (6 consecutive recessive-level bits) on detection of the error. ? transmits 8 recessive-level bits, in between transmissions, following an intermission (suspend transmission). bus-off transmission 256 or more (not indicated) note boff = 1, tecs1, tecs0 = 11 ? communication is not possible. however, when the frame is received, no messages are stored and the following operations are performed. <1> tsout toggles. <2> rec is incremented/decremented. <3> valid bit is set. ? if the initialization mode is set, after request to transit to an operation mode other than the initialization mode, 11 consecutive rece ssive-level bits are generated 128 times, and then the error counter is reset to 0 and the error active state can be restored. note the value of the transmit error counter (tec) does not carry any meaning if boff has been set. if an error that increments the value of the transmission error counte r by 8 while the counter value is in a range of 248 to 255 occurs, the counter is not increment ed and the bus-off state is assumed. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 774 (b) error counter the error counter counts up when an error has occu rred, and counts down upon successful transmission and reception. the error counter count s up immediately after error detection. table 19-14. error counter state transmission error counter (tec7 to tec0 bits) reception error counter (rec6 to rec0 bits) receiving node detects an error (except bit error in the active error flag or overload flag). no change +1 (reps bit = 0) receiving node detects dominant level following error flag of error frame. no change +8 (reps bit = 0) transmitting node transmits an error flag. [as exceptions, the error counter does not change in the following cases.] <1> ack error is detected in error passive state and dominant level is not detected while the passive error flag is being output. <2> a stuff error is detected in an arbitration field that transmitted a recessive level as a stuff bit, but a dominant level is detected. +8 no change bit error detection while active error flag or overload flag is being output (error-active transmitting node) +8 no change bit error detection while active error flag or overload flag is being output (error-active receiving node) no change +8 (reps bit = 0) when the node detects 14 consecutive dominant-level bits from the beginning of the active error flag or overload flag, and then subsequently detects 8 consecutive dominant-level bits. when the node detects 8 consecutive dominant levels after a passive error flag +8 (transmitting) +8 (receiving, reps bit = 0) when the transmitting node has co mpleted transmission without error ( 0 if error counter = 0) ?1 no change when the receiving node has completed reception without error no change ? ?1 (1 rec6 to rec0 127, reps bit = 0) ? 0 (rec6 to rec0 = 0, reps bit = 0) ? any value of 119 to 127 is set (reps bit = 1) (c) occurrence of bit error in intermission an overload frame is generated. caution if an error occurs, it is controlled accord ing to the contents of the transmission error counter and reception error counter before th e error occurred. the value of the error counter is incremented after th e error flag has been output.
chapter 19 can controller user?s manual u16603ej5v1ud 775 (5) recovery from bus-off state when the can module is in the bus-off state, the tran smission pins (ctxdn) cut off from the can bus always output the recessive level. the can module recovers from the bus-off stat e in the following bus-off recovery sequence. <1> request to enter the can initialization mode <2> request to enter a can operation mode (a) recovery operation through normal recovery sequence (b) forced recovery operation that skips recovery sequence (a) recovery from bus-off state through normal recovery sequence the can module first issues a request to enter the in itialization mode (see timing <1> in figure 19-17). this request will be immediately acknowledged, and the cnctrl.opmode2 to cnctrl.opmode0 bits are cleared to 000b. processing such as analyzing th e fault that has caused the bus-off state, re-defining the can module and message buffer using application software, or stopping t he operation of the can module can be performed by clearing the cngmctrl.gom bit to 0. next, the module requests to change the mode from the initialization mode to an operation mode (see timing <2> in figure 19-17). this starts an operation to recover the can module from the bus-off state. the conditions under which the module can recove r from the bus-off state are defined by the can protocol iso 11898, and it is necessary to detect 11 c onsecutive recessive-level bits more than 128 times. at this time, the request to change the mode to an operation mode is held pending until the recovery conditions are satisfied. when the recovery conditi ons are satisfied (see timing <3> in figure 19-17), the can module can enter the operation mode it has reques ted. until the can module enters this operation mode, it stays in the initializati on mode. whether the can module has completed transition to any other operation mode can be confirmed by reading opmode2 to opmode0. before transition to any other operation mode is completed, opmode2 to opmode0 bits = 000b is read. during the bus-off period and bus-off recovery sequence, the cninfo.boff bit stays set (to 1). in the bus-off recovery sequence, the reception error counter (cnerc.rec0 to cnerc.rec6) counts the number of times 11 consecutive recessive-level bi ts have been detected on th e bus. therefore, the recovery state can be checked by reading the rec0 to rec6 bits. cautions 1. if a request to change the mode fr om the initialization mode to any operation mode to execute the bus-off recovery sequence again during a bus-off recovery sequence, the bus-off recovery sequence starts from the beginning and 11 contiguous recessive bits are counted 128 times again on the bus. 2. in the bus-off recovery seq uence, the rec0 to rec6 bits counts up (+1) each time 11 consecutive recessive-level bits have been detected. even during the bus-off period, the can module can enter the can sleep mode or can stop mode. to be released from the bus-off state, the module must ente r the initialization mode once. if the module is in the can sleep mode or c an stop mode, however, it cannot directly enter the initialization mode. in this case, the bus off recovery sequence is started at the same time as the can sleep mode is released even without shifting to the initialization mode. in addition to clearing the cnctrl.psmode1 and cnctrl.psmode0 bits by software, the bus off recovery sequence is also started due to wakeup by dominant edge detection on the can bus (when the can clock is supplied, the psmode0 bit must be cleared by software after the dominant edge has been detected.) remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 776 figure 19-17. recovery from bus-o ff state through normal recovery sequence ?error-passive? 00h 00h 00h 00h 80h tec[7:0] ffh boff bit in cninfo register opmode[2:0] in cnctrl register (written by user) opmode[2:0] in cnctrl register (read by user) tec[7:0] in cnerc register reps, rec[6:0] in cnerc register tec > ffh 00h 00h 00h ffh < tec [7:0] ?bus-off? ?bus-off-recovery-sequence? ?error-active? 00h tec[7:0] < 80h 00h reps, rec[6:0] < 80h 00h reps, rec[6:0] 80h <1> <2> <3> undefined remark n = 0, 1 (b) forced recovery operation that skips bus-off recovery sequence the can module can be forcibly released from the bus -off state, regardless of the bus state, by skipping the bus-off recovery sequence. here is the procedure. first, the can module requests to enter the initializati on mode. for the operation and points to be noted at this time, see (a) recovery from bus-off stat e through normal r ecovery sequence . next, the module requests to enter an operation mo de. at the same time, the cnctrl.ccerc bit must be set to 1. as a result, the bus-off recovery sequence defined by the can protocol is o 11898 is skipped, and the module immediately enters the operation mode. in this case, the module is connected to the can bus after it has monitored 11 consecutive recessive-level bi ts. for details, see the processing in figure 19-54. caution this function is not defined by the can pr otocol iso 11898. when using this function, thoroughly evaluate its effe ct on the network system. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 777 (6) initializing can module error counter re gister (cnerc) in initialization mode if it is necessary to initialize the cnerc and cninfo r egisters for debugging or evaluating a program, they can be initialized to the default value by setting the cnctrl.ccerc bit in the initialization mode. when initialization has been completed, the ccerc bit is automatically cleared to 0. cautions 1. this function is enabled only in the init ialization mode. even if the ccerc bit is set to 1 in a can operation mode, the cnerc and cn info registers are not initialized. 2. the ccerc bit can be set at the same ti me as the request to enter a can operation mode. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 778 19.3.7 baud rate control function (1) prescaler the can controller has a presca ler that divides the clock (f can ) supplied to can. this prescaler generates a can protocol layer base clock (f tq ) that is the can module system clock (f canmod ) divided by 1 to 256 (see 19.6 (12) cann module bit rate prescaler register (cnbrp) ). (2) data bit time (8 to 25 time quanta) one data bit time is defined as shown in figure 19-18 . 1 time quanta = 1/f tq the can controller sets the data bit time by replacing it with the bit timing parameters such as time segment 1, time segment 2, and resynchronization jump width (sjw ), as shown in figure 19-18. time segment 1 is equivalent to the total of the propagation (prop) segm ent and phase segment 1 that are defined by the can protocol specification. time segment 2 is equivalent to phase segment 2. figure 19-18. segment setting data bit time (dbt) phase segment 1 prop segment sync segment phase segment 2 time segment 1 (tseg1) time segment 2 (tseg2) sample point (spt) segment name settable range notes on setting to conform to can specification time segment 1 (tseg1) 2tq to 16tq ? time segment 2 (tseg2) 1tq to 8tq ipt of the can controller is 0tq. to conform to the can protocol specification, theref ore, a length equal or less to phase segment 1 must be set here. this means that the length of time segment 1 minus 1tq is the settable upper limit of time segment 2. resynchronization jump width (sjw) 1tq to 4tq the length of time segment 1 minus 1tq or 4tq, whichever smaller. remark ipt: information processing time tq: time quanta
chapter 19 can controller user?s manual u16603ej5v1ud 779 remark the can protocol specification defines the segments constituting the data bit time as shown in figure 19-19. figure 19-19. configuration of data bit time defined by can specification phase segment 1 prop segment sync segment phase segment 2 sample point (spt) sjw data bit time (dbt) segment name segment length description sync segment (synchronization segment) 1 this segment starts at the edge where the level changes from recessive to dominant when hardware synchronization is established. prop segment (propagation segment) programmable to 1 to 8, or greater this segment absorbs the delay of the output buffer, can bus, and input buffer. the length of this segment is set so that ack is returned before the start of phase segment 1. time of prop segment (delay of output buffer) + 2 (delay of can bus) + (delay of input buffer) phase segment 1 (phase buffer segment 1) programmable to 1 to 8 phase segment 2 (phase buffer segment 2) phase segment 1 or ipt, whichever greater this segment compensates for an error in the data bit time. the longer this segment, the wider the permissible range but the slower the communication speed. sjw (resynchronization jump width) programmable from 1tq to segment 1tq to 4tq, whichever is smaller this width sets the upper limit of expansion or contraction of the phase segment during resynchronization. remark ipt: information processing time tq: time quanta
chapter 19 can controller user?s manual u16603ej5v1ud 780 (3) synchronizing data bit the receiving node establishes synchronization by a le vel change on the bus because it does not have a sync signal. the transmitting node transmits data in synchroniza tion with the bit timing of the transmitting node. (a) hardware synchronization this synchronization is established when the receiving node detects the start of frame in the interframe space. ? when a falling edge is detected on the bus, that tq means the sync segment and the next segment is the prop segment. in this case, synchroni zation is established regardless of sjw. figure 19-20. hardware synchronization to detect dominant level during bus idle start of frame interframe space can bus bit timing phase segment 1 prop segment sync segment phase segment 2
chapter 19 can controller user?s manual u16603ej5v1ud 781 (b) resynchronization synchronization is established again if a level change is detected on the bus during reception (only if a recessive level was sampled previously). ? the phase error of the edge is given by the relati ve position of the detected edge and sync segment. 0: if the edge is within the sync segment positive: if the edge is before the sample point (phase error) negative: if the edge is after the sample point (phase error) if phase error is positive: phase segment 1 is longer by specified sjw. if phase error is negative: phase segment 2 is shorter by specified sjw. ? the sample point of the data of t he receiving node moves relatively due to the ?discrepancy? in the baud rate between the transmitting node and receiving node. figure 19-21. resynchronization can bus bit timing can bus bit timing phase segment 1 prop segment sync segment phase segment 2 phase segment 1 prop segment sync segment phase segment 2 sample point sample point if phase error is negative if phase error is positive
chapter 19 can controller user?s manual u16603ej5v1ud 782 19.4 connection with target system the microcontroller with on-chip can controller has to be connected to the can bus using an external transceiver. figure 19-22. connection to can bus microcontroller with on-chip can controller transceiver ctxdn crxdn canl canh remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 783 19.5 internal registers of can controller 19.5.1 can controller configuration table 19-15. list of can controller registers item register name cann global control register (cngmctrl) cann global clock select ion register (cngmcs) cann global automatic bl ock transmission contro l register (cngmabt) can global registers cann global automatic bloc k transmission delay setti ng register (cngmabtd) cann module mask 1 register (cnmask1l, cnmask1h) cann module mask 2 register (cnmask2l, cnmask2h) cann module mask 3 register (cnmask3l, cnmask3h) cann module mask 4 registers (cnmask4l, cnmask4h) cann module control register (cnctrl) cann module last error information register (cnlec) cann module information register (cninfo) cann module error counter register (cnerc) cann module interrupt enable register (cnie) cann module interrupt status register (cnints) cann module bit rate pres caler register (cnbrp) cann module bit rate register (cnbtr) cann module last in-pointer register (cnlipt) cann module receive histor y list register (cnrgpt) cann module last out-pointer register (cnlopt) cann module transmit histor y list register (cntgpt) can module registers cann module time stamp register (cnts) cann message data byte 01 register m (cnmdata01m) cann message data byte 0 register m (cnmdata0m) cann message data byte 1 register m (cnmdata1m) cann message data byte 23 register m (cnmdata23m) cann message data byte 2 register m (cnmdata2m) cann message data byte 3 register m (cnmdata3m) cann message data byte 45 register m (cnmdata45m) cann message data byte 4 register m (cnmdata4m) cann message data byte 5 register m (cnmdata5m) cann message data byte 67 register m (cnmdata67m) cann message data byte 6 register m (cnmdata6m) cann message data byte 7 register m (cnmdata7m) cann message data length register m (cnmdlcm) cann message configurati on register m (cnmconfm) cann message id register m (cnmidlm, cnmidhm) message buffer registers cann message control register m (cnmctrlm) remarks 1. the can global register is defined as cngm . the can module register is defined as cn . the message buffer register is defined as cnm . 2. n = 0, 1 m = 00 to 31
chapter 19 can controller user?s manual u16603ej5v1ud 784 19.5.2 register access type table 19-16. register access types (1/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec000h can0 global control register c0gmctrl 0000h 03fec002h can0 global clock se lection register c0gmcs 0fh 03fec006h can0 global autom atic block transmission register c0gmabt 0000h 03fec008h can0 global automatic block transmission delay register c0gmabtd 00h 03fec040h c0mask1l undefined 03fec042h can0 module mask 1 register c0mask1h undefined 03fec044h c0mask2l undefined 03fec046h can0 module mask 2 register c0mask2h undefined 03fec048h c0mask3l undefined 03fec04ah can0 module mask 3 register c0mask3h undefined 03fec04ch c0mask4l undefined 03fec04eh can0 module mask 4 register c0mask4h undefined 03fec050h can0 module control register c0ctrl 0000h 03fec052h can0 module last error code register c0lec r/w 00h 03fec053h can0 module information register c0info 00h 03fec054h can0 module error counter register c0erc r 0000h 03fec056h can0 module interrupt enable register c0ie 0000h 03fec058h can0 module interrupt status register c0ints 0000h 03fec05ah can0 module bit rate prescaler register c0brp ffh 03fec05ch can0 module bit rate register c0btr r/w 370fh 03fec05eh can0 module last in-pointer register c0lipt r undefined 03fec060h can0 module receive histor y list register c0rgpt r/w xx02h 03fec062h can0 module last out-pointer register c0lopt r undefined 03fec064h can0 module transmit history list register c0tgpt xx02h 03fec066h can0 module time stamp register c0ts r/w 0000h
chapter 19 can controller user?s manual u16603ej5v1ud 785 table 19-16. register access types (2/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec100h can0 message data byte 01 register 00 c0mdata0100 undefined 03fec100h can0 message data byte 0 register 00 c0mdata000 undefined 03fec101h can0 message data byte 1 register 00 c0mdata100 undefined 03fec102h can0 message data byte 23 register 00 c0mdata2300 undefined 03fec102h can0 message data byte 2 register 00 c0mdata200 undefined 03fec103h can0 message data byte 3 register 00 c0mdata300 undefined 03fec104h can0 message data byte 45 register 00 c0mdata4500 undefined 03fec104h can0 message data byte 4 register 00 c0mdata400 undefined 03fec105h can0 message data byte 5 register 00 c0mdata500 undefined 03fec106h can0 message data byte 67 register 00 c0mdata6700 undefined 03fec106h can0 message data byte 6 register 00 c0mdata600 undefined 03fec107h can0 message data byte 7 register 00 c0mdata700 undefined 03fec108h can0 message data length register 00 c0mdlc00 0000xxxxb 03fec109h can0 message configurat ion register 00 c0mconf00 undefined 03fec10ah c0midl00 undefined 03fec10ch can0 message identifier register 00 c0midh00 undefined 03fec10eh can0 message control register 00 c0mctrl00 00x00000 000xx000b 03fec120h can0 message data byte 01 register 01 c0mdata0101 undefined 03fec120h can0 message data byte 0 register 01 c0mdata001 undefined 03fec121h can0 message data byte 1 register 01 c0mdata101 undefined 03fec122h can0 message data byte 23 register 01 c0mdata2301 undefined 03fec122h can0 message data byte 2 register 01 c0mdata201 undefined 03fec123h can0 message data byte 3 register 01 c0mdata301 undefined 03fec124h can0 message data byte 45 register 01 c0mdata4501 undefined 03fec124h can0 message data byte 4 register 01 c0mdata401 undefined 03fec125h can0 message data byte 5 register 01 c0mdata501 undefined 03fec126h can0 message data byte 67 register 01 c0mdata6701 undefined 03fec126h can0 message data byte 6 register 01 c0mdata601 undefined 03fec127h can0 message data byte 7 register 01 c0mdata701 undefined 03fec128h can0 message data length register 01 c0mdlc01 0000xxxxb 03fec129h can0 message configurat ion register 01 c0mconf01 undefined 03fec12ah c0midl01 undefined 03fec12ch can0 message identifier register 01 c0midh01 undefined 03fec12eh can0 message control register 01 c0mctrl01 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 786 table 19-16. register access types (3/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec140h can0 message data byte 01 register 02 c0mdata0102 undefined 03fec140h can0 message data byte 0 register 02 c0mdata002 undefined 03fec141h can0 message data byte 1 register 02 c0mdata102 undefined 03fec142h can0 message data byte 23 register 02 c0mdata2302 undefined 03fec142h can0 message data byte 2 register 02 c0mdata202 undefined 03fec143h can0 message data byte 3 register 02 c0mdata302 undefined 03fec144h can0 message data byte 45 register 02 c0mdata4502 undefined 03fec144h can0 message data byte 4 register 02 c0mdata402 undefined 03fec145h can0 message data byte 5 register 02 c0mdata502 undefined 03fec146h can0 message data byte 67 register 02 c0mdata6702 undefined 03fec146h can0 message data byte 6 register 02 c0mdata602 undefined 03fec147h can0 message data byte 7 register 02 c0mdata702 undefined 03fec148h can0 message data length register 02 c0mdlc02 0000xxxxb 03fec149h can0 message configurat ion register 02 c0mconf02 undefined 03fec14ah c0midl02 undefined 03fec14ch can0 message identifier register 02 c0midh02 undefined 03fec14eh can0 message control register 02 c0mctrl02 00x00000 000xx000b 03fec160h can0 message data byte 01 register 03 c0mdata0103 undefined 03fec160h can0 message data byte 0 register 03 c0mdata003 undefined 03fec161h can0 message data byte 1 register 03 c0mdata103 undefined 03fec162h can0 message data byte 23 register 03 c0mdata2303 undefined 03fec162h can0 message data byte 2 register 03 c0mdata203 undefined 03fec163h can0 message data byte 3 register 03 c0mdata303 undefined 03fec164h can0 message data byte 45 register 03 c0mdata4503 undefined 03fec164h can0 message data byte 4 register 03 c0mdata403 undefined 03fec165h can0 message data byte 5 register 03 c0mdata503 undefined 03fec166h can0 message data byte 67 register 03 c0mdata6703 undefined 03fec166h can0 message data byte 6 register 03 c0mdata603 undefined 03fec167h can0 message data byte 7 register 03 c0mdata703 undefined 03fec168h can0 message data length register 03 c0mdlc03 0000xxxxb 03fec169h can0 message configuration register 03 c0mconf03 undefined 03fec16ah c0midl03 undefined 03fec16ch can0 message identifier register 03 c0midh03 undefined 03fec16eh can0 message control register 03 c0mctrl03 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 787 table 19-16. register access types (4/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec180h can0 message data byte 01 register 04 c0mdata0104 undefined 03fec180h can0 message data byte 0 register 04 c0mdata004 undefined 03fec181h can0 message data byte 1 register 04 c0mdata104 undefined 03fec182h can0 message data byte 23 register 04 c0mdata2304 undefined 03fec182h can0 message data byte 2 register 04 c0mdata204 undefined 03fec183h can0 message data byte 3 register 04 c0mdata304 undefined 03fec184h can0 message data byte 45 register 04 c0mdata4504 undefined 03fec184h can0 message data byte 4 register 04 c0mdata404 undefined 03fec185h can0 message data byte 5 register 04 c0mdata504 undefined 03fec186h can0 message data byte 67 register 04 c0mdata6704 undefined 03fec186h can0 message data byte 6 register 04 c0mdata604 undefined 03fec187h can0 message data byte 7 register 04 c0mdata704 undefined 03fec188h can0 message data length register 04 c0mdlc04 0000xxxxb 03fec189h can0 message configurat ion register 04 c0mconf04 undefined 03fec18ah c0midl04 undefined 03fec18ch can0 message identifier register 04 c0midh04 undefined 03fec18eh can0 message control register 04 c0mctrl04 00x00000 000xx000b 03fec1a0h can0 message data byte 01 register 05 c0mdata0105 undefined 03fec1a0h can0 message data byte 0 register 05 c0mdata005 undefined 03fec1a1h can0 message data byte 1 register 05 c0mdata105 undefined 03fec1a2h can0 message data byte 23 register 05 c0mdata2305 undefined 03fec1a2h can0 message data byte 2 register 05 c0mdata205 undefined 03fec1a3h can0 message data byte 3 register 05 c0mdata305 undefined 03fec1a4h can0 message data byte 45 register 05 c0mdata4505 undefined 03fec1a4h can0 message data byte 4 register 05 c0mdata405 undefined 03fec1a5h can0 message data byte 5 register 05 c0mdata505 undefined 03fec1a6h can0 message data byte 67 register 05 c0mdata6705 undefined 03fec1a6h can0 message data byte 6 register 05 c0mdata605 undefined 03fec1a7h can0 message data byte 7 register 05 c0mdata705 undefined 03fec1a8h can0 message data length register 05 c0mdlc05 0000xxxxb 03fec1a9h can0 message configuration register 05 c0mconf05 undefined 03fec1aah c0midl05 undefined 03fec1ach can0 message identifier register 05 c0midh05 undefined 03fec1aeh can0 message control register 05 c0mctrl05 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 788 table 19-16. register access types (5/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec1c0h can0 message data byte 01 register 06 c0mdata0106 undefined 03fec1c0h can0 message data byte 0 register 06 c0mdata006 undefined 03fec1c1h can0 message data byte 1 register 06 c0mdata106 undefined 03fec1c2h can0 message data byte 23 register 06 c0mdata2306 undefined 03fec1c2h can0 message data byte 2 register 06 c0mdata206 undefined 03fec1c3h can0 message data byte 3 register 06 c0mdata306 undefined 03fec1c4h can0 message data byte 45 register 06 c0mdata4506 undefined 03fec1c4h can0 message data byte 4 register 06 c0mdata406 undefined 03fec1c5h can0 message data byte 5 register 06 c0mdata506 undefined 03fec1c6h can0 message data byte 67 register 06 c0mdata6706 undefined 03fec1c6h can0 message data byte 6 register 06 c0mdata606 undefined 03fec1c7h can0 message data byte 7 register 06 c0mdata706 undefined 03fec1c8h can0 message data length register 06 c0mdlc06 0000xxxxb 03fec1c9h can0 message configur ation register 06 c0mconf06 undefined 03fec1cah c0midl06 undefined 03fec1cch can0 message identifier register 06 c0midh06 undefined 03fec1ceh can0 message control register 06 c0mctrl06 00x00000 000xx000b 03fec1e0h can0 message data byte 01 register 07 c0mdata0107 undefined 03fec1e0h can0 message data byte 0 register 07 c0mdata007 undefined 03fec1e1h can0 message data byte 1 register 07 c0mdata107 undefined 03fec1e2h can0 message data byte 23 register 07 c0mdata2307 undefined 03fec1e2h can0 message data byte 2 register 07 c0mdata207 undefined 03fec1e3h can0 message data byte 3 register 07 c0mdata307 undefined 03fec1e4h can0 message data byte 45 register 07 c0mdata4507 undefined 03fec1e4h can0 message data byte 4 register 07 c0mdata407 undefined 03fec1e5h can0 message data byte 5 register 07 c0mdata507 undefined 03fec1e6h can0 message data byte 67 register 07 c0mdata6707 undefined 03fec1e6h can0 message data byte 6 register 07 c0mdata607 undefined 03fec1e7h can0 message data byte 7 register 07 c0mdata707 undefined 03fec1e8h can0 message data length register 07 c0mdlc07 0000xxxxb 03fec1e9h can0 message configuration register 07 c0mconf07 undefined 03fec1eah c0midl07 undefined 03fec1ech can0 message identifier register 07 c0midh07 undefined 03fec1eeh can0 message control register 07 c0mctrl07 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 789 table 19-16. register access types (6/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec200h can0 message data byte 01 register 08 c0mdata0108 undefined 03fec200h can0 message data byte 0 register 08 c0mdata008 undefined 03fec201h can0 message data byte 1 register 08 c0mdata108 undefined 03fec202h can0 message data byte 23 register 08 c0mdata2308 undefined 03fec202h can0 message data byte 2 register 08 c0mdata208 undefined 03fec203h can0 message data byte 3 register 08 c0mdata308 undefined 03fec204h can0 message data byte 45 register 08 c0mdata4508 undefined 03fec204h can0 message data byte 4 register 08 c0mdata408 undefined 03fec205h can0 message data byte 5 register 08 c0mdata508 undefined 03fec206h can0 message data byte 67 register 08 c0mdata6708 undefined 03fec206h can0 message data byte 6 register 08 c0mdata608 undefined 03fec207h can0 message data byte 7 register 08 c0mdata708 undefined 03fec208h can0 message data length register 08 c0mdlc08 0000xxxxb 03fec209h can0 message configurat ion register 08 c0mconf08 undefined 03fec20ah c0midl08 undefined 03fec20ch can0 message identifier register 08 c0midh08 undefined 03fec20eh can0 message control register 08 c0mctrl08 00x00000 000xx000b 03fec220h can0 message data byte 01 register 09 c0mdata0109 undefined 03fec220h can0 message data byte 0 register 09 c0mdata009 undefined 03fec221h can0 message data byte 1 register 09 c0mdata109 undefined 03fec222h can0 message data byte 23 register 09 c0mdata2309 undefined 03fec222h can0 message data byte 2 register 09 c0mdata209 undefined 03fec223h can0 message data byte 3 register 09 c0mdata309 undefined 03fec224h can0 message data byte 45 register 09 c0mdata4509 undefined 03fec224h can0 message data byte 4 register 09 c0mdata409 undefined 03fec225h can0 message data byte 5 register 09 c0mdata509 undefined 03fec226h can0 message data byte 67 register 09 c0mdata6709 undefined 03fec226h can0 message data byte 6 register 09 c0mdata609 undefined 03fec227h can0 message data byte 7 register 09 c0mdata709 undefined 03fec228h can0 message data length register 09 c0mdlc09 0000xxxxb 03fec229h can0 message configuration register 09 c0mconf09 undefined 03fec22ah c0midl09 undefined 03fec22ch can0 message identifier register 09 c0midh09 undefined 03fec22eh can0 message control register 09 c0mctrl09 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 790 table 19-16. register access types (7/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec240h can0 message data byte 01 register 10 c0mdata0110 undefined 03fec240h can0 message data byte 0 register 10 c0mdata010 undefined 03fec241h can0 message data byte 1 register 10 c0mdata110 undefined 03fec242h can0 message data byte 23 register 10 c0mdata2310 undefined 03fec242h can0 message data byte 2 register 10 c0mdata210 undefined 03fec243h can0 message data byte 3 register 10 c0mdata310 undefined 03fec244h can0 message data byte 45 register 10 c0mdata4510 undefined 03fec244h can0 message data byte 4 register 10 c0mdata410 undefined 03fec245h can0 message data byte 5 register 10 c0mdata510 undefined 03fec246h can0 message data byte 67 register 10 c0mdata6710 undefined 03fec246h can0 message data byte 6 register 10 c0mdata610 undefined 03fec247h can0 message data byte 7 register 10 c0mdata710 undefined 03fec248h can0 message data length register 10 c0mdlc10 0000xxxxb 03fec249h can0 message configurat ion register 10 c0mconf10 undefined 03fec24ah c0midl10 undefined 03fec24ch can0 message identifier register 10 c0midh10 undefined 03fec24eh can0 message control register 10 c0mctrl10 00x00000 000xx000b 03fec260h can0 message data byte 01 register 11 c0mdata0111 undefined 03fec260h can0 message data byte 0 register 11 c0mdata011 undefined 03fec261h can0 message data byte 1 register 11 c0mdata111 undefined 03fec262h can0 message data byte 23 register 11 c0mdata2311 undefined 03fec262h can0 message data byte 2 register 11 c0mdata211 undefined 03fec263h can0 message data byte 3 register 11 c0mdata311 undefined 03fec264h can0 message data byte 45 register 11 c0mdata4511 undefined 03fec264h can0 message data byte 4 register 11 c0mdata411 undefined 03fec265h can0 message data byte 5 register 11 c0mdata511 undefined 03fec266h can0 message data byte 67 register 11 c0mdata6711 undefined 03fec266h can0 message data byte 6 register 11 c0mdata611 undefined 03fec267h can0 message data byte 7 register 11 c0mdata711 undefined 03fec268h can0 message data length register 11 c0mdlc11 0000xxxxb 03fec269h can0 message configuration register 11 c0mconf11 undefined 03fec26ah c0midl11 undefined 03fec26ch can0 message identifier register 11 c0midh11 undefined 03fec26eh can0 message control register 11 c0mctrl11 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 791 table 19-16. register access types (8/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec280h can0 message data byte 01 register 12 c0mdata0112 undefined 03fec280h can0 message data byte 0 register 12 c0mdata012 undefined 03fec281h can0 message data byte 1 register 12 c0mdata112 undefined 03fec282h can0 message data byte 23 register 12 c0mdata2312 undefined 03fec282h can0 message data byte 2 register 12 c0mdata212 undefined 03fec283h can0 message data byte 3 register 12 c0mdata312 undefined 03fec284h can0 message data byte 45 register 12 c0mdata4512 undefined 03fec284h can0 message data byte 4 register 12 c0mdata412 undefined 03fec285h can0 message data byte 5 register 12 c0mdata512 undefined 03fec286h can0 message data byte 67 register 12 c0mdata6712 undefined 03fec286h can0 message data byte 6 register 12 c0mdata612 undefined 03fec287h can0 message data byte 7 register 12 c0mdata712 undefined 03fec288h can0 message data length register 12 c0mdlc12 0000xxxxb 03fec289h can0 message configurat ion register 12 c0mconf12 undefined 03fec28ah c0midl12 undefined 03fec28ch can0 message identifier register 12 c0midh12 undefined 03fec28eh can0 message control register 12 c0mctrl12 00x00000 000xx000b 03fec2a0h can0 message data byte 01 register 13 c0mdata0113 undefined 03fec2a0h can0 message data byte 0 register 13 c0mdata013 undefined 03fec2a1h can0 message data byte 1 register 13 c0mdata113 undefined 03fec2a2h can0 message data byte 23 register 13 c0mdata2313 undefined 03fec2a2h can0 message data byte 2 register 13 c0mdata213 undefined 03fec2a3h can0 message data byte 3 register 13 c0mdata313 undefined 03fec2a4h can0 message data byte 45 register 13 c0mdata4513 undefined 03fec2a4h can0 message data byte 4 register 13 c0mdata413 undefined 03fec2a5h can0 message data byte 5 register 13 c0mdata513 undefined 03fec2a6h can0 message data byte 67 register 13 c0mdata6713 undefined 03fec2a6h can0 message data byte 6 register 13 c0mdata613 undefined 03fec2a7h can0 message data byte 7 register 13 c0mdata713 undefined 03fec2a8h can0 message data length register 13 c0mdlc13 0000xxxxb 03fec2a9h can0 message configuration register 13 c0mconf13 undefined 03fec2aah c0midl13 undefined 03fec2ach can0 message identifier register 13 c0midh13 undefined 03fec2aeh can0 message control register 13 c0mctrl13 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 792 table 19-16. register access types (9/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec2c0h can0 message data byte 01 register 14 c0mdata0114 undefined 03fec2c0h can0 message data byte 0 register 14 c0mdata014 undefined 03fec2c1h can0 message data byte 1 register 14 c0mdata114 undefined 03fec2c2h can0 message data byte 23 register 14 c0mdata2314 undefined 03fec2c2h can0 message data byte 2 register 14 c0mdata214 undefined 03fec2c3h can0 message data byte 3 register 14 c0mdata314 undefined 03fec2c4h can0 message data byte 45 register 14 c0mdata4514 undefined 03fec2c4h can0 message data byte 4 register 14 c0mdata414 undefined 03fec2c5h can0 message data byte 5 register 14 c0mdata514 undefined 03fec2c6h can0 message data byte 67 register 14 c0mdata6714 undefined 03fec2c6h can0 message data byte 6 register 14 c0mdata614 undefined 03fec2c7h can0 message data byte 7 register 14 c0mdata714 undefined 03fec2c8h can0 message data length register 14 c0mdlc14 0000xxxxb 03fec2c9h can0 message configur ation register 14 c0mconf14 undefined 03fec2cah c0midl14 undefined 03fec2cch can0 message identifier register 14 c0midh14 undefined 03fec2ceh can0 message control register 14 c0mctrl14 00x00000 000xx000b 03fec2e0h can0 message data byte 01 register 15 c0mdata0115 undefined 03fec2e0h can0 message data byte 0 register 15 c0mdata015 undefined 03fec2e1h can0 message data byte 1 register 15 c0mdata115 undefined 03fec2e2h can0 message data byte 23 register 15 c0mdata2315 undefined 03fec2e2h can0 message data byte 2 register 15 c0mdata215 undefined 03fec2e3h can0 message data byte 3 register 15 c0mdata315 undefined 03fec2e4h can0 message data byte 45 register 15 c0mdata4515 undefined 03fec2e4h can0 message data byte 4 register 15 c0mdata415 undefined 03fec2e5h can0 message data byte 5 register 15 c0mdata515 undefined 03fec2e6h can0 message data byte 67 register 15 c0mdata6715 undefined 03fec2e6h can0 message data byte 6 register 15 c0mdata615 undefined 03fec2e7h can0 message data byte 7 register 15 c0mdata715 undefined 03fec2e8h can0 message data length register 15 c0mdlc15 0000xxxxb 03fec2e9h can0 message configuration register 15 c0mconf15 undefined 03fec2eah c0midl15 undefined 03fec2ech can0 message identifier register 15 c0midh15 undefined 03fec2eeh can0 message control register 15 c0mctrl15 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 793 table 19-16. register access types (10/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec300h can0 message data byte 01 register 16 c0mdata0116 undefined 03fec300h can0 message data byte 0 register 16 c0mdata016 undefined 03fec301h can0 message data byte 1 register 16 c0mdata116 undefined 03fec302h can0 message data byte 23 register 16 c0mdata2316 undefined 03fec302h can0 message data byte 2 register 16 c0mdata216 undefined 03fec303h can0 message data byte 3 register 16 c0mdata316 undefined 03fec304h can0 message data byte 45 register 16 c0mdata4516 undefined 03fec304h can0 message data byte 4 register 16 c0mdata416 undefined 03fec305h can0 message data byte 5 register 16 c0mdata516 undefined 03fec306h can0 message data byte 67 register 16 c0mdata6716 undefined 03fec306h can0 message data byte 6 register 16 c0mdata616 undefined 03fec307h can0 message data byte 7 register 16 c0mdata716 undefined 03fec308h can0 message data length register 16 c0mdlc16 0000xxxxb 03fec309h can0 message configurat ion register 16 c0mconf16 undefined 03fec30ah c0midl16 undefined 03fec30ch can0 message identifier register 16 c0midh16 undefined 03fec30eh can0 message control register 16 c0mctrl16 00x00000 000xx000b 03fec320h can0 message data byte 01 register 17 c0mdata0117 undefined 03fec320h can0 message data byte 0 register 17 c0mdata017 undefined 03fec321h can0 message data byte 1 register 17 c0mdata117 undefined 03fec322h can0 message data byte 23 register 17 c0mdata2317 undefined 03fec322h can0 message data byte 2 register 17 c0mdata217 undefined 03fec323h can0 message data byte 3 register 17 c0mdata317 undefined 03fec324h can0 message data byte 45 register 17 c0mdata4517 undefined 03fec324h can0 message data byte 4 register 17 c0mdata417 undefined 03fec325h can0 message data byte 5 register 17 c0mdata517 undefined 03fec326h can0 message data byte 67 register 17 c0mdata6717 undefined 03fec326h can0 message data byte 6 register 17 c0mdata617 undefined 03fec327h can0 message data byte 7 register 17 c0mdata717 undefined 03fec328h can0 message data length register 17 c0mdlc17 0000xxxxb 03fec329h can0 message configuration register 17 c0mconf17 undefined 03fec32ah c0midl17 undefined 03fec32ch can0 message identifier register 17 c0midh17 undefined 03fec32eh can0 message control register 17 c0mctrl17 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 794 table 19-16. register access types (11/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec340h can0 message data byte 01 register 18 c0mdata0118 undefined 03fec340h can0 message data byte 0 register 18 c0mdata018 undefined 03fec341h can0 message data byte 1 register 18 c0mdata118 undefined 03fec342h can0 message data byte 23 register 18 c0mdata2318 undefined 03fec342h can0 message data byte 2 register 18 c0mdata218 undefined 03fec343h can0 message data byte 3 register 18 c0mdata318 undefined 03fec344h can0 message data byte 45 register 18 c0mdata4518 undefined 03fec344h can0 message data byte 4 register 18 c0mdata418 undefined 03fec345h can0 message data byte 5 register 18 c0mdata518 undefined 03fec346h can0 message data byte 67 register 18 c0mdata6718 undefined 03fec346h can0 message data byte 6 register 18 c0mdata618 undefined 03fec347h can0 message data byte 7 register 18 c0mdata718 undefined 03fec348h can0 message data length register 18 c0mdlc18 0000xxxxb 03fec349h can0 message configurat ion register 18 c0mconf18 undefined 03fec34ah c0midl18 undefined 03fec34ch can0 message identifier register 18 c0midh18 undefined 03fec34eh can0 message control register 18 c0mctrl18 00x00000 000xx000b 03fec360h can0 message data byte 01 register 19 c0mdata0119 undefined 03fec360h can0 message data byte 0 register 19 c0mdata019 undefined 03fec361h can0 message data byte 1 register 19 c0mdata119 undefined 03fec362h can0 message data byte 23 register 19 c0mdata2319 undefined 03fec362h can0 message data byte 2 register 19 c0mdata219 undefined 03fec363h can0 message data byte 3 register 19 c0mdata319 undefined 03fec364h can0 message data byte 45 register 19 c0mdata4519 undefined 03fec364h can0 message data byte 4 register 19 c0mdata419 undefined 03fec365h can0 message data byte 5 register 19 c0mdata519 undefined 03fec366h can0 message data byte 67 register 19 c0mdata6719 undefined 03fec366h can0 message data byte 6 register 19 c0mdata619 undefined 03fec367h can0 message data byte 7 register 19 c0mdata719 undefined 03fec368h can0 message data length register 19 c0mdlc19 0000xxxxb 03fec369h can0 message configuration register 19 c0mconf19 undefined 03fec36ah c0midl19 undefined 03fec36ch can0 message identifier register 19 c0midh19 undefined 03fec36eh can0 message control register 19 c0mctrl19 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 795 table 19-16. register access types (12/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec380h can0 message data byte 01 register 20 c0mdata0120 undefined 03fec380h can0 message data byte 0 register 20 c0mdata020 undefined 03fec381h can0 message data byte 1 register 20 c0mdata120 undefined 03fec382h can0 message data byte 23 register 20 c0mdata2320 undefined 03fec382h can0 message data byte 2 register 20 c0mdata220 undefined 03fec383h can0 message data byte 3 register 20 c0mdata320 undefined 03fec384h can0 message data byte 45 register 20 c0mdata4520 undefined 03fec384h can0 message data byte 4 register 20 c0mdata420 undefined 03fec385h can0 message data byte 5 register 20 c0mdata520 undefined 03fec386h can0 message data byte 67 register 20 c0mdata6720 undefined 03fec386h can0 message data byte 6 register 20 c0mdata620 undefined 03fec387h can0 message data byte 7 register 20 c0mdata720 undefined 03fec388h can0 message data length register 20 c0mdlc20 0000xxxxb 03fec389h can0 message configurat ion register 20 c0mconf20 undefined 03fec38ah c0midl20 undefined 03fec38ch can0 message identifier register 20 c0midh20 undefined 03fec38eh can0 message control register 20 c0mctrl20 00x00000 000xx000b 03fec3a0h can0 message data byte 01 register 21 c0mdata0121 undefined 03fec3a0h can0 message data byte 0 register 21 c0mdata021 undefined 03fec3a1h can0 message data byte 1 register 21 c0mdata121 undefined 03fec3a2h can0 message data byte 23 register 21 c0mdata2321 undefined 03fec3a2h can0 message data byte 2 register 21 c0mdata221 undefined 03fec3a3h can0 message data byte 3 register 21 c0mdata321 undefined 03fec3a4h can0 message data byte 45 register 21 c0mdata4521 undefined 03fec3a4h can0 message data byte 4 register 21 c0mdata421 undefined 03fec3a5h can0 message data byte 5 register 21 c0mdata521 undefined 03fec3a6h can0 message data byte 67 register 21 c0mdata6721 undefined 03fec3a6h can0 message data byte 6 register 21 c0mdata621 undefined 03fec3a7h can0 message data byte 7 register 21 c0mdata721 undefined 03fec3a8h can0 message data length register 21 c0mdlc21 0000xxxxb 03fec3a9h can0 message configuration register 21 c0mconf21 undefined 03fec3aah c0midl21 undefined 03fec3ach can0 message identifier register 21 c0midh21 undefined 03fec3aeh can0 message control register 21 c0mctrl21 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 796 table 19-16. register access types (13/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec3c0h can0 message data byte 01 register 22 c0mdata0122 undefined 03fec3c0h can0 message data byte 0 register 22 c0mdata022 undefined 03fec3c1h can0 message data byte 1 register 22 c0mdata122 undefined 03fec3c2h can0 message data byte 23 register 22 c0mdata2322 undefined 03fec3c2h can0 message data byte 2 register 22 c0mdata222 undefined 03fec3c3h can0 message data byte 3 register 22 c0mdata322 undefined 03fec3c4h can0 message data byte 45 register 22 c0mdata4522 undefined 03fec3c4h can0 message data byte 4 register 22 c0mdata422 undefined 03fec3c5h can0 message data byte 5 register 22 c0mdata522 undefined 03fec3c6h can0 message data byte 67 register 22 c0mdata6722 undefined 03fec3c6h can0 message data byte 6 register 22 c0mdata622 undefined 03fec3c7h can0 message data byte 7 register 22 c0mdata722 undefined 03fec3c8h can0 message data length register 22 c0mdlc22 0000xxxxb 03fec3c9h can0 message configur ation register 22 c0mconf22 undefined 03fec3cah c0midl22 undefined 03fec3cch can0 message identifier register 22 c0midh22 undefined 03fec3ceh can0 message control register 22 c0mctrl22 00x00000 000xx000b 03fec3e0h can0 message data byte 01 register 23 c0mdata0123 undefined 03fec3e0h can0 message data byte 0 register 23 c0mdata023 undefined 03fec3e1h can0 message data byte 1 register 23 c0mdata123 undefined 03fec3e2h can0 message data byte 23 register 23 c0mdata2323 undefined 03fec3e2h can0 message data byte 2 register 23 c0mdata223 undefined 03fec3e3h can0 message data byte 3 register 23 c0mdata323 undefined 03fec3e4h can0 message data byte 45 register 23 c0mdata4523 undefined 03fec3e4h can0 message data byte 4 register 23 c0mdata423 undefined 03fec3e5h can0 message data byte 5 register 23 c0mdata523 undefined 03fec3e6h can0 message data byte 67 register 23 c0mdata6723 undefined 03fec3e6h can0 message data byte 6 register 23 c0mdata623 undefined 03fec3e7h can0 message data byte 7 register 23 c0mdata723 undefined 03fec3e8h can0 message data length register 23 c0mdlc23 0000xxxxb 03fec3e9h can0 message configuration register 23 c0mconf23 undefined 03fec3eah c0midl23 undefined 03fec3ech can0 message identifier register 23 c0midh23 undefined 03fec3eeh can0 message control register 23 c0mctrl23 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 797 table 19-16. register access types (14/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec400h can0 message data byte 01 register 24 c0mdata0124 undefined 03fec400h can0 message data byte 0 register 24 c0mdata024 undefined 03fec401h can0 message data byte 1 register 24 c0mdata124 undefined 03fec402h can0 message data byte 23 register 24 c0mdata2324 undefined 03fec402h can0 message data byte 2 register 24 c0mdata224 undefined 03fec403h can0 message data byte 3 register 24 c0mdata324 undefined 03fec404h can0 message data byte 45 register 24 c0mdata4524 undefined 03fec404h can0 message data byte 4 register 24 c0mdata424 undefined 03fec405h can0 message data byte 5 register 24 c0mdata524 undefined 03fec406h can0 message data byte 67 register 24 c0mdata6724 undefined 03fec406h can0 message data byte 6 register 24 c0mdata624 undefined 03fec407h can0 message data byte 7 register 24 c0mdata724 undefined 03fec408h can0 message data length register 24 c0mdlc24 0000xxxxb 03fec409h can0 message configurat ion register 24 c0mconf24 undefined 03fec40ah c0midl24 undefined 03fec40ch can0 message identifier register 24 c0midh24 undefined 03fec40eh can0 message control register 24 c0mctrl24 00x00000 000xx000b 03fec420h can0 message data byte 01 register 25 c0mdata0125 undefined 03fec420h can0 message data byte 0 register 25 c0mdata025 undefined 03fec421h can0 message data byte 1 register 25 c0mdata125 undefined 03fec422h can0 message data byte 23 register 25 c0mdata2325 undefined 03fec422h can0 message data byte 2 register 25 c0mdata225 undefined 03fec423h can0 message data byte 3 register 25 c0mdata325 undefined 03fec424h can0 message data byte 45 register 25 c0mdata4525 undefined 03fec424h can0 message data byte 4 register 25 c0mdata425 undefined 03fec425h can0 message data byte 5 register 25 c0mdata525 undefined 03fec426h can0 message data byte 67 register 25 c0mdata6725 undefined 03fec426h can0 message data byte 6 register 25 c0mdata625 undefined 03fec427h can0 message data byte 7 register 25 c0mdata725 undefined 03fec428h can0 message data length register 25 c0mdlc25 0000xxxxb 03fec429h can0 message configuration register 25 c0mconf25 undefined 03fec42ah c0midl25 undefined 03fec42ch can0 message identifier register 25 c0midh25 undefined 03fec42eh can0 message control register 25 c0mctrl25 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 798 table 19-16. register access types (15/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec440h can0 message data byte 01 register 26 c0mdata0126 undefined 03fec440h can0 message data byte 0 register 26 c0mdata026 undefined 03fec441h can0 message data byte 1 register 26 c0mdata126 undefined 03fec442h can0 message data byte 23 register 26 c0mdata2326 undefined 03fec442h can0 message data byte 2 register 26 c0mdata226 undefined 03fec443h can0 message data byte 3 register 26 c0mdata326 undefined 03fec444h can0 message data byte 45 register 26 c0mdata4526 undefined 03fec444h can0 message data byte 4 register 26 c0mdata426 undefined 03fec445h can0 message data byte 5 register 26 c0mdata526 undefined 03fec446h can0 message data byte 67 register 26 c0mdata6726 undefined 03fec446h can0 message data byte 6 register 26 c0mdata626 undefined 03fec447h can0 message data byte 7 register 26 c0mdata726 undefined 03fec448h can0 message data length register 26 c0mdlc26 0000xxxxb 03fec449h can0 message configurat ion register 26 c0mconf26 undefined 03fec44ah c0midl26 undefined 03fec44ch can0 message identifier register 26 c0midh26 undefined 03fec44eh can0 message control register 26 c0mctrl26 00x00000 000xx000b 03fec460h can0 message data byte 01 register 27 c0mdata0127 undefined 03fec460h can0 message data byte 0 register 27 c0mdata027 undefined 03fec461h can0 message data byte 1 register 27 c0mdata127 undefined 03fec462h can0 message data byte 23 register 27 c0mdata2327 undefined 03fec462h can0 message data byte 2 register 27 c0mdata227 undefined 03fec463h can0 message data byte 3 register 27 c0mdata327 undefined 03fec464h can0 message data byte 45 register 27 c0mdata4527 undefined 03fec464h can0 message data byte 4 register 27 c0mdata427 undefined 03fec465h can0 message data byte 5 register 27 c0mdata527 undefined 03fec466h can0 message data byte 67 register 27 c0mdata6727 undefined 03fec466h can0 message data byte 6 register 27 c0mdata627 undefined 03fec467h can0 message data byte 7 register 27 c0mdata727 undefined 03fec468h can0 message data length register 27 c0mdlc27 0000xxxxb 03fec469h can0 message configuration register 27 c0mconf27 undefined 03fec46ah c0midl27 undefined 03fec46ch can0 message identifier register 27 c0midh27 undefined 03fec46eh can0 message control register 27 c0mctrl27 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 799 table 19-16. register access types (16/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec480h can0 message data byte 01 register 28 c0mdata0128 undefined 03fec480h can0 message data byte 0 register 28 c0mdata028 undefined 03fec481h can0 message data byte 1 register 28 c0mdata128 undefined 03fec482h can0 message data byte 23 register 28 c0mdata2328 undefined 03fec482h can0 message data byte 2 register 28 c0mdata228 undefined 03fec483h can0 message data byte 3 register 28 c0mdata328 undefined 03fec484h can0 message data byte 45 register 28 c0mdata4528 undefined 03fec484h can0 message data byte 4 register 28 c0mdata428 undefined 03fec485h can0 message data byte 5 register 28 c0mdata528 undefined 03fec486h can0 message data byte 67 register 28 c0mdata6728 undefined 03fec486h can0 message data byte 6 register 28 c0mdata628 undefined 03fec487h can0 message data byte 7 register 28 c0mdata728 undefined 03fec488h can0 message data length register 28 c0mdlc28 0000xxxxb 03fec489h can0 message configurat ion register 28 c0mconf28 undefined 03fec48ah c0midl28 undefined 03fec48ch can0 message identifier register 28 c0midh28 undefined 03fec48eh can0 message control register 28 c0mctrl28 00x00000 000xx000b 03fec4a0h can0 message data byte 01 register 29 c0mdata0129 undefined 03fec4a0h can0 message data byte 0 register 29 c0mdata029 undefined 03fec4a1h can0 message data byte 1 register 29 c0mdata129 undefined 03fec4a2h can0 message data byte 23 register 29 c0mdata2329 undefined 03fec4a2h can0 message data byte 2 register 29 c0mdata229 undefined 03fec4a3h can0 message data byte 3 register 29 c0mdata329 undefined 03fec4a4h can0 message data byte 45 register 29 c0mdata4529 undefined 03fec4a4h can0 message data byte 4 register 29 c0mdata429 undefined 03fec4a5h can0 message data byte 5 register 29 c0mdata529 undefined 03fec4a6h can0 message data byte 67 register 29 c0mdata6729 undefined 03fec4a6h can0 message data byte 6 register 29 c0mdata629 undefined 03fec4a7h can0 message data byte 7 register 29 c0mdata729 undefined 03fec4a8h can0 message data length register 29 c0mdlc29 0000xxxxb 03fec4a9h can0 message configuration register 29 c0mconf29 undefined 03fec4aah c0midl29 undefined 03fec4ach can0 message identifier register 29 c0midh29 undefined 03fec4aeh can0 message control register 29 c0mctrl29 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 800 table 19-16. register access types (17/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec4c0h can0 message data byte 01 register 30 c0mdata0130 undefined 03fec4c0h can0 message data byte 0 register 30 c0mdata030 undefined 03fec4c1h can0 message data byte 1 register 30 c0mdata130 undefined 03fec4c2h can0 message data byte 23 register 30 c0mdata2330 undefined 03fec4c2h can0 message data byte 2 register 30 c0mdata230 undefined 03fec4c3h can0 message data byte 3 register 30 c0mdata330 undefined 03fec4c4h can0 message data byte 45 register 30 c0mdata4530 undefined 03fec4c4h can0 message data byte 4 register 30 c0mdata430 undefined 03fec4c5h can0 message data byte 5 register 30 c0mdata530 undefined 03fec4c6h can0 message data byte 67 register 30 c0mdata6730 undefined 03fec4c6h can0 message data byte 6 register 30 c0mdata630 undefined 03fec4c7h can0 message data byte 7 register 30 c0mdata730 undefined 03fec4c8h can0 message data length register 30 c0mdlc30 0000xxxxb 03fec4c9h can0 message configur ation register 30 c0mconf30 undefined 03fec4cah c0midl30 undefined 03fec4cch can0 message identifier register 30 c0midh30 undefined 03fec4ceh can0 message control register 30 c0mctrl30 00x00000 000xx000b 03fec4e0h can0 message data byte 01 register 31 c0mdata0131 undefined 03fec4e0h can0 message data byte 0 register 31 c0mdata031 undefined 03fec4e1h can0 message data byte 1 register 31 c0mdata131 undefined 03fec4e2h can0 message data byte 23 register 31 c0mdata2331 undefined 03fec4e2h can0 message data byte 2 register 31 c0mdata231 undefined 03fec4e3h can0 message data byte 3 register 31 c0mdata331 undefined 03fec4e4h can0 message data byte 45 register 31 c0mdata4531 undefined 03fec4e4h can0 message data byte 4 register 31 c0mdata431 undefined 03fec4e5h can0 message data byte 5 register 31 c0mdata531 undefined 03fec4e6h can0 message data byte 67 register 31 c0mdata6731 undefined 03fec4e6h can0 message data byte 6 register 31 c0mdata631 undefined 03fec4e7h can0 message data byte 7 register 31 c0mdata731 undefined 03fec4e8h can0 message data length register 31 c0mdlc31 0000xxxxb 03fec4e9h can0 message configuration register 31 c0mconf31 undefined 03fec4eah c0midl31 undefined 03fec4ech can0 message identifier register 31 c0midh31 undefined 03fec4eeh can0 message control register 31 c0mctrl31 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 801 table 19-16. register access types (18/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec600h can1 global control register c1gmctrl 0000h 03fec602h can1 global clock se lection register c1gmcs 0fh 03fec606h can1 global autom atic block transmission register c1gmabt 0000h 03fec608h can1 global automatic block transmission delay register c1gmabtd 00h 03fec640h c1mask1l undefined 03fec642h can1 module mask 1 register c1mask1h undefined 03fec644h c1mask2l undefined 03fec646h can1 module mask 2 register c1mask2h undefined 03fec648h c1mask3l undefined 03fec64ah can1 module mask 3 register c1mask3h undefined 03fec64ch c1mask4l undefined 03fec64eh can1 module mask 4 register c1mask4h undefined 03fec650h can1 module control register c1ctrl 0000h 03fec652h can1 module last error code register c1lec r/w 00h 03fec653h can1 module information register c1info 00h 03fec654h can1 module error counter register c1erc r 0000h 03fec656h can1 module interrupt enable register c1ie 0000h 03fec658h can1 module interrupt status register c1ints 0000h 03fec65ah can1 module bit rate prescaler register c1brp ffh 03fec65ch can1 module bit rate register c1btr r/w 370fh 03fec65eh can1 module last in-pointer register c1lipt r undefined 03fec660h can1 module receive histor y list register c1rgpt r/w xx02h 03fec662h can1 module last out-pointer register c1lopt r undefined 03fec664h can1 module transmit history list register c1tgpt xx02h 03fec666h can1 module time stamp register c1ts r/w 0000h
chapter 19 can controller user?s manual u16603ej5v1ud 802 table 19-16. register access types (19/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec700h can1 message data byte 01 register 00 c1mdata0100 undefined 03fec700h can1 message data byte 0 register 00 c1mdata000 undefined 03fec701h can1 message data byte 1 register 00 c1mdata100 undefined 03fec702h can1 message data byte 23 register 00 c1mdata2300 undefined 03fec702h can1 message data byte 2 register 00 c1mdata200 undefined 03fec703h can1 message data byte 3 register 00 c1mdata300 undefined 03fec704h can1 message data byte 45 register 00 c1mdata4500 undefined 03fec704h can1 message data byte 4 register 00 c1mdata400 undefined 03fec705h can1 message data byte 5 register 00 c1mdata500 undefined 03fec706h can1 message data byte 67 register 00 c1mdata6700 undefined 03fec706h can1 message data byte 6 register 00 c1mdata600 undefined 03fec707h can1 message data byte 7 register 00 c1mdata700 undefined 03fec708h can1 message data length register 00 c1mdlc00 0000xxxxb 03fec709h can1 message configurat ion register 00 c1mconf00 undefined 03fec70ah c1midl00 undefined 03fec70ch can1 message identifier register 00 c1midh00 undefined 03fec70eh can1 message control register 00 c1mctrl00 00x00000 000xx000b 03fec720h can1 message data byte 01 register 01 c1mdata0101 undefined 03fec720h can1 message data byte 0 register 01 c1mdata001 undefined 03fec721h can1 message data byte 1 register 01 c1mdata101 undefined 03fec722h can1 message data byte 23 register 01 c1mdata2301 undefined 03fec722h can1 message data byte 2 register 01 c1mdata201 undefined 03fec723h can1 message data byte 3 register 01 c1mdata301 undefined 03fec724h can1 message data byte 45 register 01 c1mdata4501 undefined 03fec724h can1 message data byte 4 register 01 c1mdata401 undefined 03fec725h can1 message data byte 5 register 01 c1mdata501 undefined 03fec726h can1 message data byte 67 register 01 c1mdata6701 undefined 03fec726h can1 message data byte 6 register 01 c1mdata601 undefined 03fec727h can1 message data byte 7 register 01 c1mdata701 undefined 03fec728h can1 message data length register 01 c1mdlc01 0000xxxxb 03fec729h can1 message configurat ion register 01 c1mconf01 undefined 03fec72ah c1midl01 undefined 03fec72ch can1 message identifier register 01 c1midh01 undefined 03fec72eh can1 message control register 01 c1mctrl01 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 803 table 19-16. register access types (20/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec740h can1 message data byte 01 register 02 c1mdata0102 undefined 03fec740h can1 message data byte 0 register 02 c1mdata002 undefined 03fec741h can1 message data byte 1 register 02 c1mdata102 undefined 03fec742h can1 message data byte 23 register 02 c1mdata2302 undefined 03fec742h can1 message data byte 2 register 02 c1mdata202 undefined 03fec743h can1 message data byte 3 register 02 c1mdata302 undefined 03fec744h can1 message data byte 45 register 02 c1mdata4502 undefined 03fec744h can1 message data byte 4 register 02 c1mdata402 undefined 03fec745h can1 message data byte 5 register 02 c1mdata502 undefined 03fec746h can1 message data byte 67 register 02 c1mdata6702 undefined 03fec746h can1 message data byte 6 register 02 c1mdata602 undefined 03fec747h can1 message data byte 7 register 02 c1mdata702 undefined 03fec748h can1 message data length register 02 c1mdlc02 0000xxxxb 03fec749h can1 message configurat ion register 02 c1mconf02 undefined 03fec74ah c1midl02 undefined 03fec74ch can1 message identifier register 02 c1midh02 undefined 03fec74eh can1 message control register 02 c1mctrl02 00x00000 000xx000b 03fec760h can1 message data byte 01 register 03 c1mdata0103 undefined 03fec760h can1 message data byte 0 register 03 c1mdata003 undefined 03fec761h can1 message data byte 1 register 03 c1mdata103 undefined 03fec762h can1 message data byte 23 register 03 c1mdata2303 undefined 03fec762h can1 message data byte 2 register 03 c1mdata203 undefined 03fec763h can1 message data byte 3 register 03 c1mdata303 undefined 03fec764h can1 message data byte 45 register 03 c1mdata4503 undefined 03fec764h can1 message data byte 4 register 03 c1mdata403 undefined 03fec765h can1 message data byte 5 register 03 c1mdata503 undefined 03fec766h can1 message data byte 67 register 03 c1mdata6703 undefined 03fec766h can1 message data byte 6 register 03 c1mdata603 undefined 03fec767h can1 message data byte 7 register 03 c1mdata703 undefined 03fec768h can1 message data length register 03 c1mdlc03 0000xxxxb 03fec769h can1 message configuration register 03 c1mconf03 undefined 03fec76ah c1midl03 undefined 03fec76ch can1 message identifier register 03 c1midh03 undefined 03fec76eh can1 message control register 03 c1mctrl03 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 804 table 19-16. register access types (21/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec780h can1 message data byte 01 register 04 c1mdata0104 undefined 03fec780h can1 message data byte 0 register 04 c1mdata004 undefined 03fec781h can1 message data byte 1 register 04 c1mdata104 undefined 03fec782h can1 message data byte 23 register 04 c1mdata2304 undefined 03fec782h can1 message data byte 2 register 04 c1mdata204 undefined 03fec783h can1 message data byte 3 register 04 c1mdata304 undefined 03fec784h can1 message data byte 45 register 04 c1mdata4504 undefined 03fec784h can1 message data byte 4 register 04 c1mdata404 undefined 03fec785h can1 message data byte 5 register 04 c1mdata504 undefined 03fec786h can1 message data byte 67 register 04 c1mdata6704 undefined 03fec786h can1 message data byte 6 register 04 c1mdata604 undefined 03fec787h can1 message data byte 7 register 04 c1mdata704 undefined 03fec788h can1 message data length register 04 c1mdlc04 0000xxxxb 03fec789h can1 message configurat ion register 04 c1mconf04 undefined 03fec78ah c1midl04 undefined 03fec78ch can1 message identifier register 04 c1midh04 undefined 03fec78eh can1 message control register 04 c1mctrl04 00x00000 000xx000b 03fec7a0h can1 message data byte 01 register 05 c1mdata0105 undefined 03fec7a0h can1 message data byte 0 register 05 c1mdata005 undefined 03fec7a1h can1 message data byte 1 register 05 c1mdata105 undefined 03fec7a2h can1 message data byte 23 register 05 c1mdata2305 undefined 03fec7a2h can1 message data byte 2 register 05 c1mdata205 undefined 03fec7a3h can1 message data byte 3 register 05 c1mdata305 undefined 03fec7a4h can1 message data byte 45 register 05 c1mdata4505 undefined 03fec7a4h can1 message data byte 4 register 05 c1mdata405 undefined 03fec7a5h can1 message data byte 5 register 05 c1mdata505 undefined 03fec7a6h can1 message data byte 67 register 05 c1mdata6705 undefined 03fec7a6h can1 message data byte 6 register 05 c1mdata605 undefined 03fec7a7h can1 message data byte 7 register 05 c1mdata705 undefined 03fec7a8h can1 message data length register 05 c1mdlc05 0000xxxxb 03fec7a9h can1 message configuration register 05 c1mconf05 undefined 03fec7aah c1midl05 undefined 03fec7ach can1 message identifier register 05 c1midh05 undefined 03fec7aeh can1 message control register 05 c1mctrl05 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 805 table 19-16. register access types (22/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec7c0h can1 message data byte 01 register 06 c1mdata0106 undefined 03fec7c0h can1 message data byte 0 register 06 c1mdata006 undefined 03fec7c1h can1 message data byte 1 register 06 c1mdata106 undefined 03fec7c2h can1 message data byte 23 register 06 c1mdata2306 undefined 03fec7c2h can1 message data byte 2 register 06 c1mdata206 undefined 03fec7c3h can1 message data byte 3 register 06 c1mdata306 undefined 03fec7c4h can1 message data byte 45 register 06 c1mdata4506 undefined 03fec7c4h can1 message data byte 4 register 06 c1mdata406 undefined 03fec7c5h can1 message data byte 5 register 06 c1mdata506 undefined 03fec7c6h can1 message data byte 67 register 06 c1mdata6706 undefined 03fec7c6h can1 message data byte 6 register 06 c1mdata606 undefined 03fec7c7h can1 message data byte 7 register 06 c1mdata706 undefined 03fec7c8h can1 message data length register 06 c1mdlc06 0000xxxxb 03fec7c9h can1 message configur ation register 06 c1mconf06 undefined 03fec7cah c1midl06 undefined 03fec7cch can1 message identifier register 06 c1midh06 undefined 03fec7ceh can1 message control register 06 c1mctrl06 00x00000 000xx000b 03fec7e0h can1 message data byte 01 register 07 c1mdata0107 undefined 03fec7e0h can1 message data byte 0 register 07 c1mdata007 undefined 03fec7e1h can1 message data byte 1 register 07 c1mdata107 undefined 03fec7e2h can1 message data byte 23 register 07 c1mdata2307 undefined 03fec7e2h can1 message data byte 2 register 07 c1mdata207 undefined 03fec7e3h can1 message data byte 3 register 07 c1mdata307 undefined 03fec7e4h can1 message data byte 45 register 07 c1mdata4507 undefined 03fec7e4h can1 message data byte 4 register 07 c1mdata407 undefined 03fec7e5h can1 message data byte 5 register 07 c1mdata507 undefined 03fec7e6h can1 message data byte 67 register 07 c1mdata6707 undefined 03fec7e6h can1 message data byte 6 register 07 c1mdata607 undefined 03fec7e7h can1 message data byte 7 register 07 c1mdata707 undefined 03fec7e8h can1 message data length register 07 c1mdlc07 0000xxxxb 03fec7e9h can1 message configuration register 07 c1mconf07 undefined 03fec7eah c1midl07 undefined 03fec7ech can1 message identifier register 07 c1midh07 undefined 03fec7eeh can1 message control register 07 c1mctrl07 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 806 table 19-16. register access types (23/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec800h can1 message data byte 01 register 08 c1mdata0108 undefined 03fec800h can1 message data byte 0 register 08 c1mdata008 undefined 03fec801h can1 message data byte 1 register 08 c1mdata108 undefined 03fec802h can1 message data byte 23 register 08 c1mdata2308 undefined 03fec802h can1 message data byte 2 register 08 c1mdata208 undefined 03fec803h can1 message data byte 3 register 08 c1mdata308 undefined 03fec804h can1 message data byte 45 register 08 c1mdata4508 undefined 03fec804h can1 message data byte 4 register 08 c1mdata408 undefined 03fec805h can1 message data byte 5 register 08 c1mdata508 undefined 03fec806h can1 message data byte 67 register 08 c1mdata6708 undefined 03fec806h can1 message data byte 6 register 08 c1mdata608 undefined 03fec807h can1 message data byte 7 register 08 c1mdata708 undefined 03fec808h can1 message data length register 08 c1mdlc08 0000xxxxb 03fec809h can1 message configurat ion register 08 c1mconf08 undefined 03fec80ah c1midl08 undefined 03fec80ch can1 message identifier register 08 c1midh08 undefined 03fec80eh can1 message control register 08 c1mctrl08 00x00000 000xx000b 03fec820h can1 message data byte 01 register 09 c1mdata0109 undefined 03fec820h can1 message data byte 0 register 09 c1mdata009 undefined 03fec821h can1 message data byte 1 register 09 c1mdata109 undefined 03fec822h can1 message data byte 23 register 09 c1mdata2309 undefined 03fec822h can1 message data byte 2 register 09 c1mdata209 undefined 03fec823h can1 message data byte 3 register 09 c1mdata309 undefined 03fec824h can1 message data byte 45 register 09 c1mdata4509 undefined 03fec824h can1 message data byte 4 register 09 c1mdata409 undefined 03fec825h can1 message data byte 5 register 09 c1mdata509 undefined 03fec826h can1 message data byte 67 register 09 c1mdata6709 undefined 03fec826h can1 message data byte 6 register 09 c1mdata609 undefined 03fec827h can1 message data byte 7 register 09 c1mdata709 undefined 03fec828h can1 message data length register 09 c1mdlc09 0000xxxxb 03fec829h can1 message configuration register 09 c1mconf09 undefined 03fec82ah c1midl09 undefined 03fec82ch can1 message identifier register 09 c1midh09 undefined 03fec82eh can1 message control register 09 c1mctrl09 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 807 table 19-16. register access types (24/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec840h can1 message data byte 01 register 10 c1mdata0110 undefined 03fec840h can1 message data byte 0 register 10 c1mdata010 undefined 03fec841h can1 message data byte 1 register 10 c1mdata110 undefined 03fec842h can1 message data byte 23 register 10 c1mdata2310 undefined 03fec842h can1 message data byte 2 register 10 c1mdata210 undefined 03fec843h can1 message data byte 3 register 10 c1mdata310 undefined 03fec844h can1 message data byte 45 register 10 c1mdata4510 undefined 03fec844h can1 message data byte 4 register 10 c1mdata410 undefined 03fec845h can1 message data byte 5 register 10 c1mdata510 undefined 03fec846h can1 message data byte 67 register 10 c1mdata6710 undefined 03fec846h can1 message data byte 6 register 10 c1mdata610 undefined 03fec847h can1 message data byte 7 register 10 c1mdata710 undefined 03fec848h can1 message data length register 10 c1mdlc10 0000xxxxb 03fec849h can1 message configurat ion register 10 c1mconf10 undefined 03fec84ah c1midl10 undefined 03fec84ch can1 message identifier register 10 c1midh10 undefined 03fec84eh can1 message control register 10 c1mctrl10 00x00000 000xx000b 03fec860h can1 message data byte 01 register 11 c1mdata0111 undefined 03fec860h can1 message data byte 0 register 11 c1mdata011 undefined 03fec861h can1 message data byte 1 register 11 c1mdata111 undefined 03fec862h can1 message data byte 23 register 11 c1mdata2311 undefined 03fec862h can1 message data byte 2 register 11 c1mdata211 undefined 03fec863h can1 message data byte 3 register 11 c1mdata311 undefined 03fec864h can1 message data byte 45 register 11 c1mdata4511 undefined 03fec864h can1 message data byte 4 register 11 c1mdata411 undefined 03fec865h can1 message data byte 5 register 11 c1mdata511 undefined 03fec866h can1 message data byte 67 register 11 c1mdata6711 undefined 03fec866h can1 message data byte 6 register 11 c1mdata611 undefined 03fec867h can1 message data byte 7 register 11 c1mdata711 undefined 03fec868h can1 message data length register 11 c1mdlc11 0000xxxxb 03fec869h can1 message configuration register 11 c1mconf11 undefined 03fec86ah c1midl11 undefined 03fec86ch can1 message identifier register 11 c1midh11 undefined 03fec86eh can1 message control register 11 c1mctrl11 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 808 table 19-16. register access types (25/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec880h can1 message data byte 01 register 12 c1mdata0112 undefined 03fec880h can1 message data byte 0 register 12 c1mdata012 undefined 03fec881h can1 message data byte 1 register 12 c1mdata112 undefined 03fec882h can1 message data byte 23 register 12 c1mdata2312 undefined 03fec882h can1 message data byte 2 register 12 c1mdata212 undefined 03fec883h can1 message data byte 3 register 12 c1mdata312 undefined 03fec884h can1 message data byte 45 register 12 c1mdata4512 undefined 03fec884h can1 message data byte 4 register 12 c1mdata412 undefined 03fec885h can1 message data byte 5 register 12 c1mdata512 undefined 03fec886h can1 message data byte 67 register 12 c1mdata6712 undefined 03fec886h can1 message data byte 6 register 12 c1mdata612 undefined 03fec887h can1 message data byte 7 register 12 c1mdata712 undefined 03fec888h can1 message data length register 12 c1mdlc12 0000xxxxb 03fec889h can1 message configurat ion register 12 c1mconf12 undefined 03fec88ah c1midl12 undefined 03fec88ch can1 message identifier register 12 c1midh12 undefined 03fec88eh can1 message control register 12 c1mctrl12 00x00000 000xx000b 03fec8a0h can1 message data byte 01 register 13 c1mdata0113 undefined 03fec8a0h can1 message data byte 0 register 13 c1mdata013 undefined 03fec8a1h can1 message data byte 1 register 13 c1mdata113 undefined 03fec8a2h can1 message data byte 23 register 13 c1mdata2313 undefined 03fec8a2h can1 message data byte 2 register 13 c1mdata213 undefined 03fec8a3h can1 message data byte 3 register 13 c1mdata313 undefined 03fec8a4h can1 message data byte 45 register 13 c1mdata4513 undefined 03fec8a4h can1 message data byte 4 register 13 c1mdata413 undefined 03fec8a5h can1 message data byte 5 register 13 c1mdata513 undefined 03fec8a6h can1 message data byte 67 register 13 c1mdata6713 undefined 03fec8a6h can1 message data byte 6 register 13 c1mdata613 undefined 03fec8a7h can1 message data byte 7 register 13 c1mdata713 undefined 03fec8a8h can1 message data length register 13 c1mdlc13 0000xxxxb 03fec8a9h can1 message configuration register 13 c1mconf13 undefined 03fec8aah c1midl13 undefined 03fec8ach can1 message identifier register 13 c1midh13 undefined 03fec8aeh can1 message control register 13 c1mctrl13 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 809 table 19-16. register access types (26/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec8c0h can1 message data byte 01 register 14 c1mdata0114 undefined 03fec8c0h can1 message data byte 0 register 14 c1mdata014 undefined 03fec8c1h can1 message data byte 1 register 14 c1mdata114 undefined 03fec8c2h can1 message data byte 23 register 14 c1mdata2314 undefined 03fec8c2h can1 message data byte 2 register 14 c1mdata214 undefined 03fec8c3h can1 message data byte 3 register 14 c1mdata314 undefined 03fec8c4h can1 message data byte 45 register 14 c1mdata4514 undefined 03fec8c4h can1 message data byte 4 register 14 c1mdata414 undefined 03fec8c5h can1 message data byte 5 register 14 c1mdata514 undefined 03fec8c6h can1 message data byte 67 register 14 c1mdata6714 undefined 03fec8c6h can1 message data byte 6 register 14 c1mdata614 undefined 03fec8c7h can1 message data byte 7 register 14 c1mdata714 undefined 03fec8c8h can1 message data length register 14 c1mdlc14 0000xxxxb 03fec8c9h can1 message configur ation register 14 c1mconf14 undefined 03fec8cah c1midl14 undefined 03fec8cch can1 message identifier register 14 c1midh14 undefined 03fec8ceh can1 message control register 14 c1mctrl14 00x00000 000xx000b 03fec8e0h can1 message data byte 01 register 15 c1mdata0115 undefined 03fec8e0h can1 message data byte 0 register 15 c1mdata015 undefined 03fec8e1h can1 message data byte 1 register 15 c1mdata115 undefined 03fec8e2h can1 message data byte 23 register 15 c1mdata2315 undefined 03fec8e2h can1 message data byte 2 register 15 c1mdata215 undefined 03fec8e3h can1 message data byte 3 register 15 c1mdata315 undefined 03fec8e4h can1 message data byte 45 register 15 c1mdata4515 undefined 03fec8e4h can1 message data byte 4 register 15 c1mdata415 undefined 03fec8e5h can1 message data byte 5 register 15 c1mdata515 undefined 03fec8e6h can1 message data byte 67 register 15 c1mdata6715 undefined 03fec8e6h can1 message data byte 6 register 15 c1mdata615 undefined 03fec8e7h can1 message data byte 7 register 15 c1mdata715 undefined 03fec8e8h can1 message data length register 15 c1mdlc15 0000xxxxb 03fec8e9h can1 message configuration register 15 c1mconf15 undefined 03fec8eah c1midl15 undefined 03fec8ech can1 message identifier register 15 c1midh15 undefined 03fec8eeh can1 message control register 15 c1mctrl15 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 810 table 19-16. register access types (27/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec900h can1 message data byte 01 register 16 c1mdata0116 undefined 03fec900h can1 message data byte 0 register 16 c1mdata016 undefined 03fec901h can1 message data byte 1 register 16 c1mdata116 undefined 03fec902h can1 message data byte 23 register 16 c1mdata2316 undefined 03fec902h can1 message data byte 2 register 16 c1mdata216 undefined 03fec903h can1 message data byte 3 register 16 c1mdata316 undefined 03fec904h can1 message data byte 45 register 16 c1mdata4516 undefined 03fec904h can1 message data byte 4 register 16 c1mdata416 undefined 03fec905h can1 message data byte 5 register 16 c1mdata516 undefined 03fec906h can1 message data byte 67 register 16 c1mdata6716 undefined 03fec906h can1 message data byte 6 register 16 c1mdata616 undefined 03fec907h can1 message data byte 7 register 16 c1mdata716 undefined 03fec908h can1 message data length register 16 c1mdlc16 0000xxxxb 03fec909h can1 message configurat ion register 16 c1mconf16 undefined 03fec90ah c1midl16 undefined 03fec90ch can1 message identifier register 16 c1midh16 undefined 03fec90eh can1 message control register 16 c1mctrl16 00x00000 000xx000b 03fec920h can1 message data byte 01 register 17 c1mdata0117 undefined 03fec920h can1 message data byte 0 register 17 c1mdata017 undefined 03fec921h can1 message data byte 1 register 17 c1mdata117 undefined 03fec922h can1 message data byte 23 register 17 c1mdata2317 undefined 03fec922h can1 message data byte 2 register 17 c1mdata217 undefined 03fec923h can1 message data byte 3 register 17 c1mdata317 undefined 03fec924h can1 message data byte 45 register 17 c1mdata4517 undefined 03fec924h can1 message data byte 4 register 17 c1mdata417 undefined 03fec925h can1 message data byte 5 register 17 c1mdata517 undefined 03fec926h can1 message data byte 67 register 17 c1mdata6717 undefined 03fec926h can1 message data byte 6 register 17 c1mdata617 undefined 03fec927h can1 message data byte 7 register 17 c1mdata717 undefined 03fec928h can1 message data length register 17 c1mdlc17 0000xxxxb 03fec929h can1 message configuration register 17 c1mconf17 undefined 03fec92ah c1midl17 undefined 03fec92ch can1 message identifier register 17 c1midh17 undefined 03fec92eh can1 message control register 17 c1mctrl17 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 811 table 19-16. register access types (28/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec940h can1 message data byte 01 register 18 c1mdata0118 undefined 03fec940h can1 message data byte 0 register 18 c1mdata018 undefined 03fec941h can1 message data byte 1 register 18 c1mdata118 undefined 03fec942h can1 message data byte 23 register 18 c1mdata2318 undefined 03fec942h can1 message data byte 2 register 18 c1mdata218 undefined 03fec943h can1 message data byte 3 register 18 c1mdata318 undefined 03fec944h can1 message data byte 45 register 18 c1mdata4518 undefined 03fec944h can1 message data byte 4 register 18 c1mdata418 undefined 03fec945h can1 message data byte 5 register 18 c1mdata518 undefined 03fec946h can1 message data byte 67 register 18 c1mdata6718 undefined 03fec946h can1 message data byte 6 register 18 c1mdata618 undefined 03fec947h can1 message data byte 7 register 18 c1mdata718 undefined 03fec948h can1 message data length register 18 c1mdlc18 0000xxxxb 03fec949h can1 message configurat ion register 18 c1mconf18 undefined 03fec94ah c1midl18 undefined 03fec94ch can1 message identifier register 18 c1midh18 undefined 03fec94eh can1 message control register 18 c1mctrl18 00x00000 000xx000b 03fec960h can1 message data byte 01 register 19 c1mdata0119 undefined 03fec960h can1 message data byte 0 register 19 c1mdata019 undefined 03fec961h can1 message data byte 1 register 19 c1mdata119 undefined 03fec962h can1 message data byte 23 register 19 c1mdata2319 undefined 03fec962h can1 message data byte 2 register 19 c1mdata219 undefined 03fec963h can1 message data byte 3 register 19 c1mdata319 undefined 03fec964h can1 message data byte 45 register 19 c1mdata4519 undefined 03fec964h can1 message data byte 4 register 19 c1mdata419 undefined 03fec965h can1 message data byte 5 register 19 c1mdata519 undefined 03fec966h can1 message data byte 67 register 19 c1mdata6719 undefined 03fec966h can1 message data byte 6 register 19 c1mdata619 undefined 03fec967h can1 message data byte 7 register 19 c1mdata719 undefined 03fec968h can1 message data length register 19 c1mdlc19 0000xxxxb 03fec969h can1 message configuration register 19 c1mconf19 undefined 03fec96ah c1midl19 undefined 03fec96ch can1 message identifier register 19 c1midh19 undefined 03fec96eh can1 message control register 19 c1mctrl19 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 812 table 19-16. register access types (29/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec980h can1 message data byte 01 register 20 c1mdata0120 undefined 03fec980h can1 message data byte 0 register 20 c1mdata020 undefined 03fec981h can1 message data byte 1 register 20 c1mdata120 undefined 03fec982h can1 message data byte 23 register 20 c1mdata2320 undefined 03fec982h can1 message data byte 2 register 20 c1mdata220 undefined 03fec983h can1 message data byte 3 register 20 c1mdata320 undefined 03fec984h can1 message data byte 45 register 20 c1mdata4520 undefined 03fec984h can1 message data byte 4 register 20 c1mdata420 undefined 03fec985h can1 message data byte 5 register 20 c1mdata520 undefined 03fec986h can1 message data byte 67 register 20 c1mdata6720 undefined 03fec986h can1 message data byte 6 register 20 c1mdata620 undefined 03fec987h can1 message data byte 7 register 20 c1mdata720 undefined 03fec988h can1 message data length register 20 c1mdlc20 0000xxxxb 03fec989h can1 message configurat ion register 20 c1mconf20 undefined 03fec98ah c1midl20 undefined 03fec98ch can1 message identifier register 20 c1midh20 undefined 03fec98eh can1 message control register 20 c1mctrl20 00x00000 000xx000b 03fec9a0h can1 message data byte 01 register 21 c1mdata0121 undefined 03fec9a0h can1 message data byte 0 register 21 c1mdata021 undefined 03fec9a1h can1 message data byte 1 register 21 c1mdata121 undefined 03fec9a2h can1 message data byte 23 register 21 c1mdata2321 undefined 03fec9a2h can1 message data byte 2 register 21 c1mdata221 undefined 03fec9a3h can1 message data byte 3 register 21 c1mdata321 undefined 03fec9a4h can1 message data byte 45 register 21 c1mdata4521 undefined 03fec9a4h can1 message data byte 4 register 21 c1mdata421 undefined 03fec9a5h can1 message data byte 5 register 21 c1mdata521 undefined 03fec9a6h can1 message data byte 67 register 21 c1mdata6721 undefined 03fec9a6h can1 message data byte 6 register 21 c1mdata621 undefined 03fec9a7h can1 message data byte 7 register 21 c1mdata721 undefined 03fec9a8h can1 message data length register 21 c1mdlc21 0000xxxxb 03fec9a9h can1 message configuration register 21 c1mconf21 undefined 03fec9aah c1midl21 undefined 03fec9ach can1 message identifier register 21 c1midh21 undefined 03fec9aeh can1 message control register 21 c1mctrl21 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 813 table 19-16. register access types (30/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fec9c0h can1 message data byte 01 register 22 c1mdata0122 undefined 03fec9c0h can1 message data byte 0 register 22 c1mdata022 undefined 03fec9c1h can1 message data byte 1 register 22 c1mdata122 undefined 03fec9c2h can1 message data byte 23 register 22 c1mdata2322 undefined 03fec9c2h can1 message data byte 2 register 22 c1mdata222 undefined 03fec9c3h can1 message data byte 3 register 22 c1mdata322 undefined 03fec9c4h can1 message data byte 45 register 22 c1mdata4522 undefined 03fec9c4h can1 message data byte 4 register 22 c1mdata422 undefined 03fec9c5h can1 message data byte 5 register 22 c1mdata522 undefined 03fec9c6h can1 message data byte 67 register 22 c1mdata6722 undefined 03fec9c6h can1 message data byte 6 register 22 c1mdata622 undefined 03fec9c7h can1 message data byte 7 register 22 c1mdata722 undefined 03fec9c8h can1 message data length register 22 c1mdlc22 0000xxxxb 03fec9c9h can1 message configur ation register 22 c1mconf22 undefined 03fec9cah c1midl22 undefined 03fec9cch can1 message identifier register 22 c1midh22 undefined 03fec9ceh can1 message control register 22 c1mctrl22 00x00000 000xx000b 03fec9e0h can1 message data byte 01 register 23 c1mdata0123 undefined 03fec9e0h can1 message data byte 0 register 23 c1mdata023 undefined 03fec9e1h can1 message data byte 1 register 23 c1mdata123 undefined 03fec9e2h can1 message data byte 23 register 23 c1mdata2323 undefined 03fec9e2h can1 message data byte 2 register 23 c1mdata223 undefined 03fec9e3h can1 message data byte 3 register 23 c1mdata323 undefined 03fec9e4h can1 message data byte 45 register 23 c1mdata4523 undefined 03fec9e4h can1 message data byte 4 register 23 c1mdata423 undefined 03fec9e5h can1 message data byte 5 register 23 c1mdata523 undefined 03fec9e6h can1 message data byte 67 register 23 c1mdata6723 undefined 03fec9e6h can1 message data byte 6 register 23 c1mdata623 undefined 03fec9e7h can1 message data byte 7 register 23 c1mdata723 undefined 03fec9e8h can1 message data length register 23 c1mdlc23 0000xxxxb 03fec9e9h can1 message configuration register 23 c1mconf23 undefined 03fec9eah c1midl23 undefined 03fec9ech can1 message identifier register 23 c1midh23 undefined 03fec9eeh can1 message control register 23 c1mctrl23 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 814 table 19-16. register access types (31/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03feca00h can1 message data byte 01 register 24 c1mdata0124 undefined 03feca00h can1 message data byte 0 register 24 c1mdata024 undefined 03feca01h can1 message data byte 1 register 24 c1mdata124 undefined 03feca02h can1 message data byte 23 register 24 c1mdata2324 undefined 03feca02h can1 message data byte 2 register 24 c1mdata224 undefined 03feca03h can1 message data byte 3 register 24 c1mdata324 undefined 03feca04h can1 message data byte 45 register 24 c1mdata4524 undefined 03feca04h can1 message data byte 4 register 24 c1mdata424 undefined 03feca05h can1 message data byte 5 register 24 c1mdata524 undefined 03feca06h can1 message data byte 67 register 24 c1mdata6724 undefined 03feca06h can1 message data byte 6 register 24 c1mdata624 undefined 03feca07h can1 message data byte 7 register 24 c1mdata724 undefined 03feca08h can1 message data length register 24 c1mdlc24 0000xxxxb 03feca09h can1 message configur ation register 24 c1mconf24 undefined 03feca0ah c1midl24 undefined 03feca0ch can1 message identifier register 24 c1midh24 undefined 03feca0eh can1 message control register 24 c1mctrl24 00x00000 000xx000b 03feca20h can1 message data byte 01 register 25 c1mdata0125 undefined 03feca20h can1 message data byte 0 register 25 c1mdata025 undefined 03feca21h can1 message data byte 1 register 25 c1mdata125 undefined 03feca22h can1 message data byte 23 register 25 c1mdata2325 undefined 03feca22h can1 message data byte 2 register 25 c1mdata225 undefined 03feca23h can1 message data byte 3 register 25 c1mdata325 undefined 03feca24h can1 message data byte 45 register 25 c1mdata4525 undefined 03feca24h can1 message data byte 4 register 25 c1mdata425 undefined 03feca25h can1 message data byte 5 register 25 c1mdata525 undefined 03feca26h can1 message data byte 67 register 25 c1mdata6725 undefined 03feca26h can1 message data byte 6 register 25 c1mdata625 undefined 03feca27h can1 message data byte 7 register 25 c1mdata725 undefined 03feca28h can1 message data length register 25 c1mdlc25 0000xxxxb 03feca29h can1 message configuration register 25 c1mconf25 undefined 03feca2ah c1midl25 undefined 03feca2ch can1 message identifier register 25 c1midh25 undefined 03feca2eh can1 message control register 25 c1mctrl25 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 815 table 19-16. register access types (32/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03feca40h can1 message data byte 01 register 26 c1mdata0126 undefined 03feca40h can1 message data byte 0 register 26 c1mdata026 undefined 03feca41h can1 message data byte 1 register 26 c1mdata126 undefined 03feca42h can1 message data byte 23 register 26 c1mdata2326 undefined 03feca42h can1 message data byte 2 register 26 c1mdata226 undefined 03feca43h can1 message data byte 3 register 26 c1mdata326 undefined 03feca44h can1 message data byte 45 register 26 c1mdata4526 undefined 03feca44h can1 message data byte 4 register 26 c1mdata426 undefined 03feca45h can1 message data byte 5 register 26 c1mdata526 undefined 03feca46h can1 message data byte 67 register 26 c1mdata6726 undefined 03feca46h can1 message data byte 6 register 26 c1mdata626 undefined 03feca47h can1 message data byte 7 register 26 c1mdata726 undefined 03feca48h can1 message data length register 26 c1mdlc26 0000xxxxb 03feca49h can1 message configur ation register 26 c1mconf26 undefined 03feca4ah c1midl26 undefined 03feca4ch can1 message identifier register 26 c1midh26 undefined 03feca4eh can1 message control register 26 c1mctrl26 00x00000 000xx000b 03feca60h can1 message data byte 01 register 27 c1mdata0127 undefined 03feca60h can1 message data byte 0 register 27 c1mdata027 undefined 03feca61h can1 message data byte 1 register 27 c1mdata127 undefined 03feca62h can1 message data byte 23 register 27 c1mdata2327 undefined 03feca62h can1 message data byte 2 register 27 c1mdata227 undefined 03feca63h can1 message data byte 3 register 27 c1mdata327 undefined 03feca64h can1 message data byte 45 register 27 c1mdata4527 undefined 03feca64h can1 message data byte 4 register 27 c1mdata427 undefined 03feca65h can1 message data byte 5 register 27 c1mdata527 undefined 03feca66h can1 message data byte 67 register 27 c1mdata6727 undefined 03feca66h can1 message data byte 6 register 27 c1mdata627 undefined 03feca67h can1 message data byte 7 register 27 c1mdata727 undefined 03feca68h can1 message data length register 27 c1mdlc27 0000xxxxb 03feca69h can1 message configuration register 27 c1mconf27 undefined 03feca6ah c1midl27 undefined 03feca6ch can1 message identifier register 27 c1midh27 undefined 03feca6eh can1 message control register 27 c1mctrl27 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 816 table 19-16. register access types (33/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03feca80h can1 message data byte 01 register 28 c1mdata0128 undefined 03feca80h can1 message data byte 0 register 28 c1mdata028 undefined 03feca81h can1 message data byte 1 register 28 c1mdata128 undefined 03feca82h can1 message data byte 23 register 28 c1mdata2328 undefined 03feca82h can1 message data byte 2 register 28 c1mdata228 undefined 03feca83h can1 message data byte 3 register 28 c1mdata328 undefined 03feca84h can1 message data byte 45 register 28 c1mdata4528 undefined 03feca84h can1 message data byte 4 register 28 c1mdata428 undefined 03feca85h can1 message data byte 5 register 28 c1mdata528 undefined 03feca86h can1 message data byte 67 register 28 c1mdata6728 undefined 03feca86h can1 message data byte 6 register 28 c1mdata628 undefined 03feca87h can1 message data byte 7 register 28 c1mdata728 undefined 03feca88h can1 message data length register 28 c1mdlc28 0000xxxxb 03feca89h can1 message configur ation register 28 c1mconf28 undefined 03feca8ah c1midl28 undefined 03feca8ch can1 message identifier register 28 c1midh28 undefined 03feca8eh can1 message control register 28 c1mctrl28 00x00000 000xx000b 03fecaa0h can1 message data byte 01 register 29 c1mdata0129 undefined 03fecaa0h can1 message data byte 0 register 29 c1mdata029 undefined 03fecaa1h can1 message data byte 1 register 29 c1mdata129 undefined 03fecaa2h can1 message data byte 23 register 29 c1mdata2329 undefined 03fecaa2h can1 message data byte 2 register 29 c1mdata229 undefined 03fecaa3h can1 message data byte 3 register 29 c1mdata329 undefined 03fecaa4h can1 message data byte 45 register 29 c1mdata4529 undefined 03fecaa4h can1 message data byte 4 register 29 c1mdata429 undefined 03fecaa5h can1 message data byte 5 register 29 c1mdata529 undefined 03fecaa6h can1 message data byte 67 register 29 c1mdata6729 undefined 03fecaa6h can1 message data byte 6 register 29 c1mdata629 undefined 03fecaa7h can1 message data byte 7 register 29 c1mdata729 undefined 03fecaa8h can1 message data length register 29 c1mdlc29 0000xxxxb 03fecaa9h can1 message configuration register 29 c1mconf29 undefined 03fecaaah c1midl29 undefined 03fecaach can1 message identifier register 29 c1midh29 undefined 03fecaaeh can1 message control register 29 c1mctrl29 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 817 table 19-16. register access types (34/34) bit manipulation units address register name symbol r/w 1 bit 8 bits 16 bits after reset 03fecac0h can1 message data byte 01 register 30 c1mdata0130 undefined 03fecac0h can1 message data byte 0 register 30 c1mdata030 undefined 03fecac1h can1 message data byte 1 register 30 c1mdata130 undefined 03fecac2h can1 message data byte 23 register 30 c1mdata2330 undefined 03fecac2h can1 message data byte 2 register 30 c1mdata230 undefined 03fecac3h can1 message data byte 3 register 30 c1mdata330 undefined 03fecac4h can1 message data byte 45 register 30 c1mdata4530 undefined 03fecac4h can1 message data byte 4 register 30 c1mdata430 undefined 03fecac5h can1 message data byte 5 register 30 c1mdata530 undefined 03fecac6h can1 message data byte 67 register 30 c1mdata6730 undefined 03fecac6h can1 message data byte 6 register 30 c1mdata630 undefined 03fecac7h can1 message data byte 7 register 30 c1mdata730 undefined 03fecac8h can1 message data length register 30 c1mdlc30 0000xxxxb 03fecac9h can1 message configur ation register 30 c1mconf30 undefined 03fecacah c1midl30 undefined 03fecacch can1 message identifier register 30 c1midh30 undefined 03fecaceh can1 message control register 30 c1mctrl30 00x00000 000xx000b 03fecae0h can1 message data byte 01 register 31 c1mdata0131 undefined 03fecae0h can1 message data byte 0 register 31 c1mdata031 undefined 03fecae1h can1 message data byte 1 register 31 c1mdata131 undefined 03fecae2h can1 message data byte 23 register 31 c1mdata2331 undefined 03fecae2h can1 message data byte 2 register 31 c1mdata231 undefined 03fecae3h can1 message data byte 3 register 31 c1mdata331 undefined 03fecae4h can1 message data byte 45 register 31 c1mdata4531 undefined 03fecae4h can1 message data byte 4 register 31 c1mdata431 undefined 03fecae5h can1 message data byte 5 register 31 c1mdata531 undefined 03fecae6h can1 message data byte 67 register 31 c1mdata6731 undefined 03fecae6h can1 message data byte 6 register 31 c1mdata631 undefined 03fecae7h can1 message data byte 7 register 31 c1mdata731 undefined 03fecae8h can1 message data length register 31 c1mdlc31 0000xxxxb 03fecae9h can1 message configuration register 31 c1mconf31 undefined 03fecaeah c1midl31 undefined 03fecaech can1 message identifier register 31 c1midh31 undefined 03fecaeeh can1 message control register 31 c1mctrl31 r/w 00x00000 000xx000b
chapter 19 can controller user?s manual u16603ej5v1ud 818 19.5.3 register bit configuration table 19-17. can global register bit configuration address symbol bit 7/15 bit 6/14 bit 5/13 bit 4/12 bit 3/11 bit 2/10 bit 1/9 bit 0/8 03fexx00h 0 0 0 0 0 0 0 clear gom 03fexx01h cngmctrl (w) 0 0 0 0 0 0 set efsd set gom 03fexx00h 0 0 0 0 0 0 efsd gom 03fexx01h cngmctrl (r) mbon 0 0 0 0 0 0 0 03fexx02h cngmcs 0 0 0 0 ccp3 ccp2 ccp1 ccp0 03fexx06h 0 0 0 0 0 0 0 clear abttrg 03fexx07h cngmabt (w) 0 0 0 0 0 0 set abtclr set abttrg 03fexx06h 0 0 0 0 0 0 abtclr abttrg 03fexx07h cngmabt (r) 0 0 0 0 0 0 0 0 03fexx08h cngmabtd 0 0 0 0 abtd3 abtd2 abtd1 abtd0 remark n = 0, 1 when n = 0, xx = c0 when n = 1, xx = c6
chapter 19 can controller user?s manual u16603ej5v1ud 819 table 19-18. can module register bit configuration (1/2) address symbol bit 7/15 bit 6/14 bit 5/13 bit 4/12 bit 3/11 bit 2/10 bit 1/9 bit 0/8 03fexx40h cmid7 to cmid0 03fexx41h cnmask1l cmid15 to cmid8 03fexx42h cmid23 to cmid16 03fexx43h cnmask1h 0 0 0 cmid28 to cmid24 03fexx44h cmid7 to cmid0 03fexx45h cnmask2l cmid15 to cmid8 03fexx46h cmid23 to cmid16 03fexx47h cnmask2h 0 0 0 cmid28 to cmid24 03fexx48h cmid7 to cmid0 03fexx49h cnmask3l cmid15 to cmid8 03fexx4ah cmid23 to cmid16 03fexx4bh cnmask3h 0 0 0 cmid28 to cmid24 03fexx4ch cmid7 to cmid0 03fexx4dh cnmask4l cmid15 to cmid8 03fexx4eh cmid23 to cmid16 03fexx4fh cnmask4h 0 0 0 cmid28 to cmid24 03fexx50h 0 clear al clear valid clear psmode1 clear psmode0 clear opmode2 clear opmode1 clear opmode0 03fexx51h cnctrl (w) set ccerc set al 0 set psmode1 set psmode0 set opmode2 set opmode1 set opmode0 03fexx50h ccerc al valid ps mode1 ps mode0 op mode2 op mode1 op mode0 03fexx51h cnctrl (r) 0 0 0 0 0 0 rstat tstat 03fexx52h cnlec (w) 0 0 0 0 0 0 0 0 03fexx52h cnlec (r) 0 0 0 0 0 lec2 lec1 lec0 03fexx53h cninfo 0 0 0 boff tecs1 tecs0 recs1 recs0 03fexx54h tec7 to tec0 03fexx55h cnerc reps rec6 to rec0 03fexx56h 0 0 clear cie5 clear cie4 clear cie3 clear cie2 clear cie1 clear cie0 03fexx57h cnie (w) 0 0 set cie5 set cie4 set cie3 set cie2 set cie1 set cie0 03fexx56h 0 0 cie5 cie4 cie3 cie2 cie1 cie0 03fexx57h cnie (r) 0 0 0 0 0 0 0 0 03fexx58h 0 0 clear cints5 clear cints4 clear cints3 clear cints2 clear cints1 clear cints0 03fexx59h cnints (w) 0 0 0 0 0 0 0 0 03fexx58h 0 0 cints5 cints4 cints3 cints2 cints1 cints0 03fexx59h cnints (r) 0 0 0 0 0 0 0 0 remark n = 0, 1 when n = 0, xx = c0 when n = 1, xx = c6
chapter 19 can controller user?s manual u16603ej5v1ud 820 table 19-18. can module register bit configuration (2/2) address symbol bit 7/15 bit 6/14 bit 5/13 bit 4/12 bit 3/11 bit 2/10 bit 1/9 bit 0/8 03fexx5ah cnbrp tqprs7 to tqprs0 03fexx5ch 0 0 0 0 tseg13 to tseg10 03fexx5dh cnbtr 0 0 sjw1, sjw0 0 tseg22 to tseg20 03fexx5eh cnlipt lipt7 to lipt0 03fexx60h 0 0 0 0 0 0 0 clear rovf 03fexx61h cnrgpt (w) 0 0 0 0 0 0 0 0 03fexx60h 0 0 0 0 0 0 rhpm rovf 03fexx61h cnrgpt (r) rgpt7 to rgpt0 03fexx62h cnlopt lopt7 to lopt0 03fexx64h 0 0 0 0 0 0 0 clear tovf 03fexx65h cntgpt (w) 0 0 0 0 0 0 0 0 03fexx64h 0 0 0 0 0 0 thpm tovf 03fexx65h cntgpt (r) tgpt7 to tgpt0 03fexx66h 0 0 0 0 0 clear tslock clear tssel clear tsen 03fexx67h cnts (w) 0 0 0 0 0 set tslock set tssel set tsen 03fexx66h 0 0 0 0 0 tslock tssel tsen 03fexx67h cnts (r) 0 0 0 0 0 0 0 0 03fexx68h to 03fexxffh ? access prohibited (reserved for future use) remark n = 0, 1 when n = 0, xx = c0 when n = 1, xx = c6
chapter 19 can controller user?s manual u16603ej5v1ud 821 table 19-19. message buffer register bit configuration address symbol bit 7/15 bit 6/14 bit 5/13 bit 4/12 bit 3/11 bit 2/10 bit 1/9 bit 0/8 03fexxx0h message data (byte 0) 03fexxx1h cnmdata01m message data (byte 1) 03fexxx0h cnmdata0m message data (byte 0) 03fexxx1h cnmdata1m message data (byte 1) 03fexxx2h message data (byte 2) 03fexxx3h cnmdata23m message data (byte 3) 03fexxx2h cnmdata2m message data (byte 2) 03fexxx3h cnmdata3m message data (byte 3) 03fexxx4h message data (byte 4) 03fexxx5h cnmdata45m message data (byte 5) 03fexxx4h cnmdata4m message data (byte 4) 03fexxx5h cnmdata5m message data (byte 5) 03fexxx6h message data (byte 6) 03fexxx7h cnmdata67m message data (byte 7) 03fexxx6h cnmdata6m message data (byte 6) 03fexxx7h cnmdata7m message data (byte 7) 03fexxx8h cnmdlcm 0 mdlc3 mdlc2 mdlc1 mdlc0 03fexxx9h cnmconfm ows rtr mt2 mt1 mt0 0 0 ma0 03fexxxah id7 id6 id5 id4 id3 id2 id1 id0 03fexxxbh cnmidlm id15 id14 id13 id12 id11 id10 id9 id8 03fexxxch id23 id22 id21 id20 id19 id18 id17 id16 03fexxxdh cnmidhm ide 0 0 id28 id27 id26 id25 id24 03fexxxeh 0 0 0 clear mow clear ie clear dn clear trq clear rdy 03fexxxfh cnmctrlm (w) 0 0 0 0 set ie 0 set trq set rdy 03fexxxeh 0 0 0 mow ie dn trq rdy 03fexxxfh cnmctrlm (r) 0 0 muc 0 0 0 0 0 03fexxx0h to 03fexxxfh ? access prohibited (reserved for future use) remark n = 0, 1 m = 00 to 31 when n = 0, xx = 10, 12, 14, 16, 18, 1a, 1c, 1e, 20, 22, 24, 26, 28, 2a, 2c, 2e, 30, 32, 34, 36, 38, 3a, 3c, 3e, 40, 42, 44, 46, 48, 4a, 4c, 4e when n = 1, xx = 70, 72, 74, 76, 78, 7a, 7c, 7e, 80, 82, 84, 86, 88, 8a, 8c, 8e, 90, 92, 94, 96, 98, 9a, 9c, 9e, a0, a2, a4, a6, a8, aa, ac, ae
chapter 19 can controller user?s manual u16603ej5v1ud 822 19.6 registers caution accessing the can controller registers is prohibi ted in the following statuses. for details, see 3.4.9 (2) accessing specific on-ch ip peripheral i/o registers. ? when the cpu operates with the subclock a nd the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock remark n = 0, 1 m = 00 to 31 (1) cann global control register (cngmctrl) the cngmctrl register is used to cont rol the operation of the can module. (1/2) after reset: 0000h r/w address: c0gmctrl 03fec000h, c1gmctrl 03fec600h (a) read 15 14 13 12 11 10 9 8 cngmctrl mbon 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 0 0 0 0 0 0 efsd gom (b) write 15 14 13 12 11 10 9 8 cngmctrl 0 0 0 0 0 0 set efsd set gom 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 clear gom (a) read mbon bit enabling access to message buffer regi ster, transmit/receive history registers 0 write access and read access to the message buffer register and the transm it/receive history list registers is disabled. 1 write access and read access to the message buffer register and the transm it/receive history list registers is enabled. cautions 1. while the mbon bit is cleared (to 0), software access to the message buffers (cnmdata0m, cnmdata1m, cnmdat a01m, cnmdata2m, cnmdata3m, cnmdata23m, cnmdata4m, cnmdat a5m, cnmdata45m, cnmdata6m, cnmdata7m, cnmdata67m, cnmdlcm, cnmconfm, cnmidlm, cnmidhm, and cnmctrlm), or registers re lated to transmit history or receive history (cnlopt, cntgpt, cnlipt, and cnrgpt) is disabled. 2. this bit is read-only. even if 1 is written to the mbon bit while it is 0, the value of the mbon bit does not change, and access to th e message buffer registers, or registers related to transmit history or receive history remains disabled. remark when the can sleep mode/can stop mode is entered , or when the gom bit is cleared to 0, the mbon bit is cleared to 0. when the can sl eep mode/can stop mode is released, or when the gom bit is set to 1, the mbon bit is set to 1.
chapter 19 can controller user?s manual u16603ej5v1ud 823 (2/2) efsd bit enabling forced shut down 0 forced shut down by gom bit = 0 disabled. 1 forced shut down by gom bit = 0 enabled. caution to request forced shut down, clear the gom bit to 0 immediately after the efsd bit has been set to 1. if access to a nother register (including read ing the cngmctrl register) is executed without clearing the gom bit immediatel y after the efsd bit has been set to 1, the efsd bit is forcibly cl eared to 0, and the forced shut down request is invalid. gom global operation mode bit 0 can module is disabled from operating. 1 can module is enabled to operate. caution the gom bit is cleared to 0 only in the in itialization mode or immediately after the efsd bit is set to 1. (b) write set efsd efsd bit setting 0 no change in efsd bit. 1 efsd bit set to 1. set gom clear gom gom bit setting 0 1 gom bit cleared to 0. 1 0 gom bit set to 1. other than above no change in gom bit. caution be sure to set the gom bit and efsd bit separately.
chapter 19 can controller user?s manual u16603ej5v1ud 824 (2) cann global clock selection register (cngmcs) the cngmcs register is used to select the can module system clock. after reset: 0fh r/w address: c0gmcs 03fec002h, c1gmcs 03fec602h 7 6 5 4 3 2 1 0 cngmcs 0 0 0 0 ccp3 ccp2 ccp1 ccp0 ccp3 ccp2 ccp1 ccp1 can module system clock (f canmod ) 0 0 0 0 f can /1 0 0 0 1 f can /2 0 0 1 0 f can /3 0 0 1 1 f can /4 0 1 0 0 f can /5 0 1 0 1 f can /6 0 1 1 0 f can /7 0 1 1 1 f can /8 1 0 0 0 f can /9 1 0 0 1 f can /10 1 0 1 0 f can /11 1 0 1 1 f can /12 1 1 0 0 f can /13 1 1 0 1 f can /14 1 1 1 0 f can /15 1 1 1 1 f can /16 (default value) remark f can = clock supplied to can = f xx
chapter 19 can controller user?s manual u16603ej5v1ud 825 (3) cann global automatic block transm ission control register (cngmabt) the cngmabt register is used to control the automatic block transmission (abt) operation. (1/2) after reset: 0000h r/w address: c0gmabt 03fec006h, c1gmabt 03fec606h (a) read 15 14 13 12 11 10 9 8 cngmabt 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 0 0 0 0 0 0 abtclr abttrg (a) write 15 14 13 12 11 10 9 8 cngmabt 0 0 0 0 0 0 set abtclr set abttrg 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 clear abttrg caution before changing the norma l operation mode with abt to the initialization mode, be sure to set the cngmabt register to the default value (0000h). after setting, confirm that the cngmabt register is initialized to 0000h. (a) read abtclr automatic block transmi ssion engine clear status bit 0 clearing the automatic transmission engine is completed. 1 the automatic transmissi on engine is being cleared. remarks 1. set the abtclr bit to 1 while t he abttrg bit is cleared to 0. the operation is not guaranteed if the abtclr bit is set to 1 while the abttrg bit is set to 1. 2. when the automatic block transmission engine is cleared by setting the abtclr bit to 1, the abtclr bit is automatically cleared to 0 as soon as the requested clearing processing is complete. abttrg automatic block transmission status bit 0 automatic block transmission is stopped. 1 automatic block transmissi on is under execution. cautions 1. do not set the abttrg bit to 1 in the initialization mode. if the abttrg bit is set to 1 in the initialization mode, the operation is not guaranteed after the can module has entered the normal operation mode with abt. 2. do not set the abttrg bit to 1 while the cn ctrl.tstat bit is set to 1. directly confirm that the tstat bit = 0 before setting the abttrg bit to 1.
chapter 19 can controller user?s manual u16603ej5v1ud 826 (2/2) (b) write set abtclr automatic block trans mission engine clear request bit 0 the automatic block transmission engine is in idle status or under operation. 1 request to clear the automatic block transmissi on engine. after the automatic block transmission engine has been cleared, automatic block transmission is started from message buffer 0 by setting the abttrg bit to 1. set abttrg clear abttrg automati c block transmi ssion start bit 0 1 request to stop automatic block transmission. 1 0 request to start automatic block transmission. other than above no change in abttrg bit. caution even if the abttrg bit is set (1), tran smission is not immediatel y executed, depending on the situation such as when a message is received from another node or when a message other than the abt message (message buffers 8 to 31) is transmitted. even if the abttrg bit is cleared (0), tr ansmission is not terminated midway. if transmission is under execution, it is continued until comp leted (regardless of whether transmission is successful or fails).
chapter 19 can controller user?s manual u16603ej5v1ud 827 (4) cann global automatic block transm ission delay register (cngmabtd) the cngmabtd register is used to set the interval at which the data of the message buffer assigned to abt is to be transmitted in the normal operation mode with abt. after reset: 00h r/w address: c0gmabtd 03fec008h, c1gmabtd 03fec608h 7 6 5 4 3 2 1 0 cngmabtd 0 0 0 0 abtd3 abtd2 abtd1 abtd0 abtd3 abtd2 abtd1 abtd0 data frame interval during aut omatic block transmission (unit: data bit time (dbt)) 0 0 0 0 0 dbt (default value) 0 0 0 1 2 5 dbt 0 0 1 0 2 6 dbt 0 0 1 1 2 7 dbt 0 1 0 0 2 8 dbt 0 1 0 1 2 9 dbt 0 1 1 0 2 10 dbt 0 1 1 1 2 11 dbt 1 0 0 0 2 12 dbt other than above setting prohibited cautions 1. do not change the contents of the cngmabtd register while the abttrg bit is set to 1. 2. the timing at which th e abt message is actually transmitted onto the can bus differs depending on the status of transmission from the other station or how a request to transmit a message other than an abt mess age (message buffers 8 to 31) is made.
chapter 19 can controller user?s manual u16603ej5v1ud 828 (5) cann module mask control register (cnmas kal, cnmaskah) (a = 1, 2, 3, or 4) the cnmaskal and cnmaskah registers are used to ex tend the number of receivable messages in the same message buffer by masking part of the identifier (id) of a message and invalidating the id comparison of the masked part. (1/2) ? cann module mask 1 register (cnmask1l, cnmask1h) after reset: undefined r/w address: c0mask1l 03fec040h, c1mask1l 03fec640h, c0mask1h 03fec042h, c1mask1h 03fec642h 15 14 13 12 11 10 9 8 cnmask1l cmid15 cmid14 cmid13 cmid12 cmid11 cmid10 cmid9 cmid8 7 6 5 4 3 2 1 0 cmid7 cmid6 cmid5 cmid4 cmid3 cmid2 cmid1 cmid0 15 14 13 12 11 10 9 8 cnmask1h 0 0 0 cmid28 cmid27 cmid26 cmid25 cmid24 7 6 5 4 3 2 1 0 cmid23 cmid22 cmid21 cmid20 cmid19 cmid18 cmid17 cmid16 ? cann module mask 2 register (cnmask2l, cnmask2h) after reset: undefined r/w address: c0mask2l 03fec044h, c1mask2l 03fec644h, c0mask2h 03fec046h, c1mask2h 03fec646h 15 14 13 12 11 10 9 8 cnmask2l cmid15 cmid14 cmid13 cmid12 cmid11 cmid10 cmid9 cmid8 7 6 5 4 3 2 1 0 cmid7 cmid6 cmid5 cmid4 cmid3 cmid2 cmid1 cmid0 15 14 13 12 11 10 9 8 cnmask2h 0 0 0 cmid28 cmid27 cmid26 cmid25 cmid24 7 6 5 4 3 2 1 0 cmid23 cmid22 cmid21 cmid20 cmid19 cmid18 cmid17 cmid16
chapter 19 can controller user?s manual u16603ej5v1ud 829 (2/2) ? cann module mask 3 register (cnmask3l, cnmask3h) after reset: undefined r/w address: c0mask3l 03fec048h, c1mask3l 03fec648h, c0mask3h 03fec04ah, c1mask3h 03fec64ah 15 14 13 12 11 10 9 8 cnmask3l cmid15 cmid14 cmid13 cmid12 cmid11 cmid10 cmid9 cmid8 7 6 5 4 3 2 1 0 cmid7 cmid6 cmid5 cmid4 cmid3 cmid2 cmid1 cmid0 15 14 13 12 11 10 9 8 cnmask3h 0 0 0 cmid28 cmid27 cmid26 cmid25 cmid24 7 6 5 4 3 2 1 0 cmid23 cmid22 cmid21 cmid20 cmid19 cmid18 cmid17 cmid16 ? cann module mask 4 register (cnmask4l, cnmask4h) after reset: undefined r/w address: c0mask4l 03fec04ch, c1mask4l 03fec64ch, c0mask4h 03fec04eh, c1mask4h 03fec64eh 15 14 13 12 11 10 9 8 cnmask4l cmid15 cmid14 cmid13 cmid12 cmid11 cmid10 cmid9 cmid8 7 6 5 4 3 2 1 0 cmid7 cmid6 cmid5 cmid4 cmid3 cmid2 cmid1 cmid0 15 14 13 12 11 10 9 8 cnmask4h 0 0 0 cmid28 cmid27 cmid26 cmid25 cmid24 7 6 5 4 3 2 1 0 cmid23 cmid22 cmid21 cmid20 cmid19 cmid18 cmid17 cmid16 cmid28 to cmid0 mask pattern setting of id bit 0 the id bits of the message buffer set by the cmid28 to cmid0 bits are compared with the id bits of the received message frame. 1 the id bits of the message buffer set by the cmid28 to cmid0 bits are not compared with the id bits of the received message frame (they are masked). remark masking is always defined by an id length of 29 bits. if a mask is assigned to a message with a standard id, the cmid17 to cmid0 bits are ignored. therefore, only the cmid28 to cmid18 bits of the received id are masked. the same mask can be used for both the standard and extended ids.
chapter 19 can controller user?s manual u16603ej5v1ud 830 (6) cann module control register (cnctrl) the cnctrl register is used to control the operation mode of the can module. (1/4) after reset: 0000h r/w address: c0ctrl 03fec050h, c1ctrl 03fec650h (a) read 15 14 13 12 11 10 9 8 cnctrl 0 0 0 0 0 0 rstat tstat 7 6 5 4 3 2 1 0 ccerc al valid psmode 1 psmode 0 opmode 2 opmode 1 opmode 0 (a) write 15 14 13 12 11 10 9 8 cnctrl set ccerc set al 0 set psmode 1 set psmode 0 set opmode 2 set opmode 1 set opmode 0 7 6 5 4 3 2 1 0 0 clear al clear valid clear psmode 1 clear psmode 0 clear opmode 2 clear opmode 1 clear opmode 0 (a) read rstat reception status bit 0 reception is stopped. 1 reception is in progress. remark the rstat bit is set to 1 under the following conditions (timing) ? the sof bit of a receive frame is detected ? on occurrence of arbitration loss during a transmit frame the rstat bit is cleared to 0 under the following conditions (timing) ? when a recessive level is detected at t he second bit of the interframe space ? on transition to the initialization mode at the first bit of the interframe space tstat transmission status bit 0 transmission is stopped. 1 transmission is in progress. remark the tstat bit is set to 1 under the following conditions (timing) ? the sof bit of a transmit frame is detected the tstat bit is cleared to 0 under the following conditions (timing) ? during transition to bus-off status ? on occurrence of arbitration loss in transmit frame ? on detection of recessive level at t he second bit of the interframe space ? on transition to the initialization mode at the first bit of the interframe space
chapter 19 can controller user?s manual u16603ej5v1ud 831 (2/4) ccerc error counter clear bit 0 the cnerc and cninfo registers are not cleared in the initialization mode. 1 the cnerc and cninfo registers are cleared in the initialization mode. remarks 1. the ccerc bit is used to clear the cnerc and cninfo registers for re-initialization or forced recovery from the bus-off status. this bi t can be set to 1 only in the initialization mode. 2. when the cnerc and cninfo registers have been cleared, the ccerc bit is also cleared to 0 automatically. 3. the ccerc bit can be set to 1 at the same time as a request to change the initialization mode to an operation mode is made. 4. if the ccerc bit is set to 1 immediately after t he init mode is entered in the self test mode, the receive data may be corrupted. al bit to set operation in case of arbitration loss 0 re-transmission is not executed in case of an arbitration loss in the single-shot mode. 1 re-transmission is executed in case of an arbitration loss in the single-shot mode. remark the al bit is valid only in the single-shot mode. valid valid receive message frame detection bit 0 a valid message frame has not been received since the valid bit was last cleared to 0. 1 a valid message frame has been received since the valid bit was last cleared to 0. remarks 1 . detection of a valid receive message frame is not dependent upon the existence or non- existence of the storage in the receive me ssage buffer (data frame) or transmit message buffer (remote frame). 2. clear the valid bit (0) before changing the initialization mode to an operation mode. 3 . if only two can nodes are connected to the can bus with one transmitting a message frame in the normal mode and the other in the receive-only mode, since no ack is generated in the receive-only mode, the valid bit is not set to 1 before the transmitting node enters the error passive status. 4 . to clear the valid bit, set the clear valid bit to 1 first and confirm that the valid bit is cleared. if it is not cleared, perform clearing processing again.
chapter 19 can controller user?s manual u16603ej5v1ud 832 (3/4) psmode1 psmode0 power save mode 0 0 no power save mode is selected. 0 1 can sleep mode 1 0 setting prohibited 1 1 can stop mode cautions 1. transition to and from the can stop mode must be made via can sleep mode. a request for direct transition to a nd from the can stop mode is ignored. 2. after releasing the power save mode, the cngmctrl.mbon flag must be checked before accessing the message buffer again. 3. a request for transition to the can sleep mode is held pe nding until it is canceled by software or until the can bus enters the bus idle state. the software can check transition to the can sleep mode by r eading the psmode0 and psmode1 bits. opmode2 opmode1 opmo de0 operation mode 0 0 0 no operation mode is selected (can module is in the initialization mode). 0 0 1 normal operation mode 0 1 0 normal operation mode with automat ic block transmission function (normal operation mode with abt) 0 1 1 receive-only mode 1 0 0 single-shot mode 1 0 1 self-test mode other than above setting prohibited caution it may take time to change the mode to the initialization mode or power save mode. therefore, be sure to check if the mode has been successfully cha nged, by reading the register value before executing the processing. remark the opmode0 to opmode2 bits are read- only in the can sleep mode or can stop mode. (b) write set ccerc setting of ccerc bit 1 ccerc bit is set to 1. other than above ccerc bit is not changed. set al clear al setting of al bit 0 1 al bit is cleared to 0. 1 0 al bit is set to 1. other than above al bit is not changed. clear valid setting of valid bit 0 valid bit is not changed. 1 valid bit is cleared to 0.
chapter 19 can controller user?s manual u16603ej5v1ud 833 (4/4) set psmode0 clear psmode0 setting of psmode0 bit 0 1 psmode0 bit is cleared to 0. 1 0 psmode bit is set to 1. other than above psmode0 bit is not changed. set psmode1 clear psmode1 setting of psmode1 bit 0 1 psmode1 bit is cleared to 0. 1 0 psmode1 bit is set to 1. other than above psmode1 bit is not changed. set opmode0 clear opmode0 setting of opmode0 bit 0 1 opmode0 bit is cleared to 0. 1 0 opmode0 bit is set to 1. other than above opmode0 bit is not changed. set opmode1 clear opmode1 setting of opmode1 bit 0 1 opmode1 bit is cleared to 0. 1 0 opmode1 bit is set to 1. other than above opmode1 bit is not changed. set opmode2 clear opmode2 setting of opmode2 bit 0 1 opmode2 bit is cleared to 0. 1 0 opmode2 bit is set to 1. other than above opmode2 bit is not changed.
chapter 19 can controller user?s manual u16603ej5v1ud 834 (7) cann module last error in formation register (cnlec) the cnlec register provides the erro r information of the can protocol. after reset: 00h r/w address: c0lec 03fec052h, c1lec 03fec652h 7 6 5 4 3 2 1 0 cnlec 0 0 0 0 0 lec2 lec1 lec0 remarks 1. the contents of the cnlec register are not cl eared when the can module changes from an operation mode to the initialization mode. 2. if an attempt is made to write a value other than 00h to the cnlec register by software, the access is ignored. lec2 lec1 lec0 last can protocol error information 0 0 0 no error 0 0 1 stuff error 0 1 0 form error 0 1 1 ack error 1 0 0 bit error. (the can module tried to transm it a recessive-level bit as part of a transmit message (except the arbitration fi eld), but the value on the can bus is a dominant-level bit.) 1 0 1 bit error. (the can module tried to tran smit a dominant-level bit as part of a transmit message, ack bit, error frame, or overload frame, but the value on the can bus is a recessive-level bit.) 1 1 0 crc error 1 1 1 undefined
chapter 19 can controller user?s manual u16603ej5v1ud 835 (8) cann module information register (cninfo) the cninfo register indicates the status of the can module. after reset: 00h r address: c0info 03fec053h, c1info 03fec653h 7 6 5 4 3 2 1 0 cninfo 0 0 0 boff tecs1 tecs0 recs1 recs0 boff bus-off status bit 0 not bus-off status (transmit error counter 255). (the value of the transmi t counter is less than 256.) 1 bus-off status (transmit error counter > 255). (the value of the transmit error counter is 256 or more.) tecs1 tecs0 transmission e rror counter status bit 0 0 the value of the transmission error counter is less than that of the warning level ( < 96). 0 1 the value of the transmission error counter is in the range of the warning level (96 to 127). 1 0 undefined 1 1 the value of the transmission error counter is in the range of the error passive or bus-off status ( 128). recs1 recs0 reception error counter status bit 0 0 the value of the reception error counter is less than that of the warning level ( < 96). 0 1 the value of the reception error counter is in the range of the warning level (96 to 127). 1 0 undefined 1 1 the value of the reception error c ounter is in the error passive range ( 128).
chapter 19 can controller user?s manual u16603ej5v1ud 836 (9) cann module error counter register (cnerc) the cnerc register indicates the count value of the transmission/reception error counter. after reset: 0000h r address: c0erc 03fec054h, c1erc 03fec654h 15 14 13 12 11 10 9 8 cnerc reps rec6 rec5 rec4 rec3 rec2 rec1 rec0 7 6 5 4 3 2 1 0 tec7 tec6 tec5 tec4 tec3 tec2 tec1 tec0 reps reception error passive status bit 0 the value of the reception error c ounter is not error passive (< 128) 1 the value of the reception error count er is in the error passive range ( 128) rec6 to rec0 reception error counter bit 0 to 127 number of reception errors. these bits reflect the status of the reception error counter. the number of errors is defined by the can protocol. remark the rec6 to rec0 bits of the reception error counter are invalid in the reception error passive status (cninfo.recs1, cn info.recs0 bit = 11b). tec7 to tec0 transmission error counter bit 0 to 255 number of transmission errors. these bits reflect the status of the transmission error counter. the number of errors is defined by the can protocol. remark the tec7 to tec0 bits of the transmission er ror counter are invalid in the bus-off status (cninfo.boff bit = 1).
chapter 19 can controller user?s manual u16603ej5v1ud 837 (10) cann module interrupt enable register (cnie) the cnie register is used to enable or disable the interrupts of the can module. (1/2) after reset: 0000h r/w address: c0ie 03fec056h, c1ie 03fec656h (a) read 15 14 13 12 11 10 9 8 cnie 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 0 0 cie5 cie4 cie3 cie2 cie1 cie0 (b) write 15 14 13 12 11 10 9 8 cnie 0 0 set cie5 set cie4 set cie3 set cie2 set cie1 set cie0 7 6 5 4 3 2 1 0 0 0 clear cie5 clear cie4 clear cie3 clear cie2 clear cie1 clear cie0 (a) read cie5 to cie0 can module interrupt enable bit 0 output of the interrupt corresponding to inte rrupt status register cintsx is disabled. 1 output of the interrupt corresponding to interrupt status register cintsx is enabled.
chapter 19 can controller user?s manual u16603ej5v1ud 838 (2/2) (b) write set cie5 clear cie5 setting of cie5 bit 0 1 cie5 bit is cleared to 0. 1 0 cie5 bit is set to 1. other than above cie5 bit is not changed. set cie4 clear cie4 setting of cie4 bit 0 1 cie4 bit is cleared to 0. 1 0 cie4 bit is set to 1. other than above cie4 bit is not changed. set cie3 clear cie3 setting of cie3 bit 0 1 cie3 bit is cleared to 0. 1 0 cie3 bit is set to 1. other than above cie3 bit is not changed. set cie2 clear cie2 setting of cie2 bit 0 1 cie2 bit is cleared to 0. 1 0 cie2 bit is set to 1. other than above cie2 bit is not changed. set cie1 clear cie1 setting of cie1 bit 0 1 cie1 bit is cleared to 0. 1 0 cie1 bit is set to 1. other than above cie1 bit is not changed. set cie0 clear cie0 setting of cie0 bit 0 1 cie0 bit is cleared to 0. 1 0 cie0 bit is set to 1. other than above cie0 bit is not changed.
chapter 19 can controller user?s manual u16603ej5v1ud 839 (11) cann module interrupt st atus register (cnints) the cnints register indicates the in terrupt status of the can module. after reset: 0000h r/w address: c0ints 03fec058h, c1ints 03fec658h (a) read 15 14 13 12 11 10 9 8 cnints 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 0 0 cints5 cints4 cints3 cints2 cints1 cints0 (b) write 15 14 13 12 11 10 9 8 cnints 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 0 0 clear cints5 clear cints4 clear cints3 clear cints2 clear cints1 clear cints0 (a) read cints5 to cints0 can interrupt status bit 0 no related interrupt source event is generated. 1 a related interrupt source event is generated. interrupt status bit related interrupt source event cints5 wakeup interrupt from can sleep mode note cints4 arbitration loss interrupt cints3 can protocol error interrupt cints2 can error status interrupt cints1 interrupt on completion of reception of valid message frame to message buffer m cints0 interrupt on normal completion of tr ansmission of message frame from message buffer m note the cints5 bit is set (1) only when the can m odule is woken up from the can sleep mode by a can bus operation. the cints5 bit is not set (1) when the can sleep mode has been released by software. (b) write clear cints5 to cints0 setting of cints5 to cints0 bits 0 cints5 to cints0 bits are not changed. 1 cints5 to cints0 bits are cleared to 0. caution the status bit of this register is not auto matically cleared. clear it (0) by software if each status must be checked in the interrupt servicing.
chapter 19 can controller user?s manual u16603ej5v1ud 840 (12) cann module bit rate prescaler register (cnbrp) the cnbrp register is used to select the can protocol layer base clock (f tq ). the communication baud rate is set to the cnbtr register. caution the cnbrp register can be write- accessed only in the initialization mode. after reset: ffh r/w address: c0brp 03fec05ah, c1brp 03fec65ah 7 6 5 4 3 2 1 0 cnbrp tqprs7 tqprs6 tqprs5 tqprs4 tqprs3 tqprs2 tqprs1 tqprs0 tqprs7 to tqprs0 can protocol layer base system clock (f tq ) 0 f canmod /1 1 f canmod /2 n f canmod /(n+1) : : 255 f canmod /256 (default value) figure 19-23. can module clock ccp 3 ccp2 prescaler cann module bit rate prescaler register (cnbrp) cann global clock selection register (cngmcs) baud rate generator cann bit rate register (cnbtr) ccp1 ccp0 tqprs0 f can f canmod f tq 0 0 0 0 tqprs1 tqprs2 tqprs3 tqprs4 tqprs5 tqprs6 tqprs7 remark f can : clock supplied to can = f xx f canmod : can module system clock f tq : can protocol layer basic system clock
chapter 19 can controller user?s manual u16603ej5v1ud 841 (13) cann module bit rate register (cnbtr) the cnbtr register is used to control the data bit time of the communication baud rate. figure 19-24. data bit time data bit time (dbt) time segment 1 (tseg1) phase segment 2 phase segment 1 sample point (spt) prop segment sync segment time segment 2 (tseg2)
chapter 19 can controller user?s manual u16603ej5v1ud 842 after reset: 370fh r/w address: c0btr 03fec05ch, c1btr 03fec65ch 15 14 13 12 11 10 9 8 cnbtr 0 0 sjw1 sjw0 0 tseg22 tseg21 tseg20 7 6 5 4 3 2 1 0 0 0 0 0 tseg13 t seg12 tseg11 tseg10 sjw1 sjw0 length of synchronization jump width 0 0 1tq 0 1 2tq 1 0 3tq 1 1 4tq (default value) tseg22 tseg21 tseg20 length of time segment 2 0 0 0 1tq 0 0 1 2tq 0 1 0 3tq 0 1 1 4tq 1 0 0 5tq 1 0 1 6tq 1 1 0 7tq 1 1 1 8tq (default value) tseg13 tseg12 tseg 11 tseg10 length of time segment 1 0 0 0 0 setting prohibited 0 0 0 1 2tq note 0 0 1 0 3tq note 0 0 1 1 4tq 0 1 0 0 5tq 0 1 0 1 6tq 0 1 1 0 7tq 0 1 1 1 8tq 1 0 0 0 9tq 1 0 0 1 10tq 1 0 1 0 11tq 1 0 1 1 12tq 1 1 0 0 13tq 1 1 0 1 14tq 1 1 1 0 15tq 1 1 1 1 16tq (default value) note this setting must not be made when the cnbrp register = 00h. remark tq = 1/f tq (f tq : can protocol layer basic system clock)
chapter 19 can controller user?s manual u16603ej5v1ud 843 (14) cann module last in-pointer register (cnlipt) the cnlipt register indicates the number of the message buffer in which a data frame or a remote frame was last stored. after reset: undefined r address: c0lipt 03fec05eh, c1lipt 03fec65eh 7 6 5 4 3 2 1 0 cnlipt lipt7 lipt6 lipt5 li pt4 lipt3 lipt2 lipt1 lipt0 lipt7 to lipt0 last in-pointer register (cnlipt) 0 to 31 when the cnlipt register is read, the contents of the element indexed by the last in-pointer (lipt) of the receive history list are read. these contents indicate the number of the message buffer in which a data frame or a remote frame was last stored. remark the read value of the cnlipt register is unde fined if a data frame or a remote frame has never been stored in the message buffer. if the cnrgpt.rhpm bit is set to 1 after the can module has changed from the initialization mode to an oper ation mode, therefore, the read value of the cnlipt register is undefined.
chapter 19 can controller user?s manual u16603ej5v1ud 844 (15) cann module receive history list register (cnrgpt) the cnrgpt register is used to read the receive history list. after reset: xx02h r/w address: c0rgpt 03fec060h, c1rgpt 03fec660h (a) read 15 14 13 12 11 10 9 8 cnrgpt rgpt7 rgpt6 rgpt5 rg pt4 rgpt3 rgpt2 rgpt1 rgpt0 7 6 5 4 3 2 1 0 0 0 0 0 0 0 rhpm rovf (b) write 15 14 13 12 11 10 9 8 cnrgpt 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 clear rovf (a) read rgpt7 to rgpt0 receive history list read pointer 0 to 31 when the cnrgpt register is read, the contents of the element indexed by the receive history list get pointer (rgpt) of the receive history list are re ad. these contents indicate the number of the message buffer in which a data frame or a remote frame has been stored. rhpm note 1 receive history list pointer match 0 the receive history list has at least one message buffer number that has not been read. 1 the receive history list has no message buffer numbers that have not been read. rovf note 2 receive history list overflow bit 0 all the message buffer numbers that have not bee n read are preserved. all the numbers of the message buffers in which a new data frame or remo te frame has been received and stored are recorded to the receive history list (the receive history list has a vacant element). 1 at least 23 entries have been stored since the host processor serviced the rhl last time (i.e. read cnrgpt). the first 22 entries are sequentially stored whereas the last entry might have been overwritten by newly received messages a number of times because all buffer numbers are stored at position lipt-1 when the rovf bit is set to 1. as a consequence receptions cannot be completely recovered in the order that they were received. notes 1. the read value of the rgpt 0 to rgpt7 bits is invalid when the rhpm bit = 1. 2. if all the receive history is read by the cnrgpt register while the rovf bit is set (1), the rhpm bit is not cleared (0) but kept set (1 ) even if newly received data is stored. (b) write clear rovf setting of rovf bit 0 rovf bit is not changed. 1 rovf bit is cleared to 0.
chapter 19 can controller user?s manual u16603ej5v1ud 845 (16) cann module last out-p ointer register (cnlopt) the cnlopt register indicates the number of the message buffer to which a data frame or a remote frame was transmitted last. after reset: undefined r address: c0lopt 03fec062h, c1lopt 03fec662h 7 6 5 4 3 2 1 0 cnlopt lopt7 lopt6 lopt5 lo pt4 lopt3 lopt 2 lopt1 lopt0 lopt7 to lopt0 last out-pointer of transmit history list (lopt) 0 to 31 when the cnlopt register is read, the contents of the element indexed by the last out-pointer (lopt) of the receive history list are read. these contents indicate the number of the message buffer to which a data frame or a remote frame was transmitted last. remark the value read from the cnlopt register is un defined if a data frame or remote frame has never been transmitted from a message buffer. if the cntgpt.thpm bit is set to 1 after the can module has changed from the initialization mode to an operation mode, therefore, the read value of the cnlopt register is undefined.
chapter 19 can controller user?s manual u16603ej5v1ud 846 (17) cann module transmit history list register (cntgpt) the cntgpt register is used to read the transmit history list. after reset: xx02h r/w address: c0tgpt 03fec064h, c1tgpt 03fec664h (a) read 15 14 13 12 11 10 9 8 cntgpt tgpt7 tgpt6 tgpt5 tg pt4 tgpt3 tgpt2 tgpt1 tgpt0 7 6 5 4 3 2 1 0 0 0 0 0 0 0 thpm tovf (b) write 15 14 13 12 11 10 9 8 cntgpt 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 clear tovf (a) read tgpt7 to tgpt0 transmit history list read pointer 0 to 31 when the cntgpt register is read, the content s of the element indexed by the read pointer (tgpt) of the transmit history list are read. these contents indicate the number of the message buffer to which a data frame or a remote frame was transmitted last. thpm note 1 transmit history pointer match 0 the transmit history list has at least one message buffer number that has not been read. 1 the transmit history list has no message buffer numbers that have not been read. tovf note 2 transmit history list overflow bit 0 all the message buffer numbers that have not bee n read are preserved. all the numbers of the message buffers to which a new data frame or remote frame has been transmitted are recorded to the transmit history list (the transm it history list has a vacant element). 1 at least 7 entries have been stored since the host processor serviced the thl last time (i.e. read cntgpt). the first 6 entries are sequentially stored whereas the last entry might have been overwritten by newly transmitted messages a number of times because all buffer numbers are stored at position lopt-1 when tovf bit is se t to 1. as a consequence receptions cannot be completely recovered in the order that they were received. notes 1. the read value of the tgpt 0 to tgpt7 bits is invalid when the thpm bit = 1. 2. if all the transmit history is read by the cntgpt r egister while the tovf bit is set (1), the thpm bit is not cleared (0) but kept set (1), even if transmission of new data has been completed. remark transmission from message buffers 0 to 7 is not recorded to the transmit history list in the normal operation mode with abt. (b) write clear tovf setting of tovf bit 0 tovf bit is not changed. 1 tovf bit is cleared to 0.
chapter 19 can controller user?s manual u16603ej5v1ud 847 (18) cann module time stamp register (cnts) the cnts register is used to c ontrol the time stamp function. (1/2) after reset: 0000h r/w address: c0ts 03fec066h, c1ts 03fec666h (a) read 15 14 13 12 11 10 9 8 cnts 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 0 0 0 0 0 tslock tssel tsen (b) write 15 14 13 12 11 10 9 8 cnts 0 0 0 0 0 set tslock set tssel set tsen 7 6 5 4 3 2 1 0 0 0 0 0 0 clear tslock clear tssel clear tsen remark the lock function of the time stamp functions mu st not be used when the can module is in the normal operation mode with abt. (a) read tslock time stamp lock function enable bit 0 time stamp lock function stopped. the tsout signal toggles each time the selected time stamp capture event occurs. 1 time stamp lock function enabled. the tsout signal toggles each time the selected ti me stamp capture event occurred. however, the tsout output signal is locked when a data frame has been correctly received to message buffer 0 note . note the tsen bit is automatically cleared to 0. tssel time stamp capture event selection bit 0 the time stamp capture event is sof. 1 the time stamp capture event is the last bit of eof. tsen tsout operation setting bit 0 tsout toggle operation is disabled. 1 tsout toggle operation is enabled. remark the tsout signal is output from the can controller to a timer. for details, see chapter 7 16-bit timer/event counter p (tmp) .
chapter 19 can controller user?s manual u16603ej5v1ud 848 (2/2) (b) write set tslock clear tslock setting of tslock bit 0 1 tslock bit is cleared to 0. 1 0 tslock bit is set to 1. other than above tslock bit is not changed. set tssel clear tssel setting of tssel bit 0 1 tssel bit is cleared to 0. 1 0 tssel bit is set to 1. other than above tssel bit is not changed. set tsen clear tsen setting of tsen bit 0 1 tsen bit is cleared to 0. 1 0 tsen bit is set to 1. other than above tsen bit is not changed .
chapter 19 can controller user?s manual u16603ej5v1ud 849 (19) cann message data byte register (cnmdataxm, cnmdataym) (x = 0 to 7, y = 01, 23, 45, 67) the cnmdataxm register is used to store the data of a transmit/receive message, and can be accessed in 8-bit unit. the cnmdataxm register can be accessed in 16-bit units by the cnmdataym register. (1/2) after reset: undefined r/w address: see table 19-16 . 15 14 13 12 11 10 9 8 cnmdata01m mdata01 15 mdata01 14 mdata01 13 mdata01 12 mdata01 11 mdata01 10 mdata01 9 mdata01 8 7 6 5 4 3 2 1 0 mdata01 7 mdata01 6 mdata01 5 mdata01 4 mdata01 3 mdata01 2 mdata01 1 mdata01 0 7 6 5 4 3 2 1 0 cnmdata0m mdata0 7 mdata0 6 mdata0 5 mdata0 4 mdata0 3 mdata0 2 mdata0 1 mdata0 0 7 6 5 4 3 2 1 0 cnmdata1m mdata1 7 mdata1 6 mdata1 5 mdata1 4 mdata1 3 mdata1 2 mdata1 1 mdata1 0 15 14 13 12 11 10 9 8 cnmdata23m mdata23 15 mdata23 14 mdata23 13 mdata23 12 mdata23 11 mdata23 10 mdata23 9 mdata23 8 7 6 5 4 3 2 1 0 mdata23 7 mdata23 6 mdata23 5 mdata23 4 mdata23 3 mdata23 2 mdata23 1 mdata23 0 7 6 5 4 3 2 1 0 cnmdata2m mdata2 7 mdata2 6 mdata2 5 mdata2 4 mdata2 3 mdata2 2 mdata2 1 mdata2 0 7 6 5 4 3 2 1 0 cnmdata3m mdata3 7 mdata3 6 mdata3 5 mdata3 4 mdata3 3 mdata3 2 mdata3 1 mdata3 0
chapter 19 can controller user?s manual u16603ej5v1ud 850 (2/2) 15 14 13 12 11 10 9 8 cnmdata45m mdata45 15 mdata45 14 mdata45 13 mdata45 12 mdata45 11 mdata45 10 mdata45 9 mdata45 8 7 6 5 4 3 2 1 0 mdata45 7 mdata45 6 mdata45 5 mdata45 4 mdata45 3 mdata45 2 mdata45 1 mdata45 0 7 6 5 4 3 2 1 0 cnmdata4m mdata4 7 mdata4 6 mdata4 5 mdata4 4 mdata4 3 mdata4 2 mdata4 1 mdata4 0 7 6 5 4 3 2 1 0 cnmdata5m mdata5 7 mdata5 6 mdata5 5 mdata5 4 mdata5 3 mdata5 2 mdata5 1 mdata5 0 15 14 13 12 11 10 9 8 cnmdata67m mdata67 15 mdata67 14 mdata67 13 mdata67 12 mdata67 11 mdata67 10 mdata67 9 mdata67 8 7 6 5 4 3 2 1 0 mdata67 7 mdata67 6 mdata67 5 mdata67 4 mdata67 3 mdata67 2 mdata67 1 mdata67 0 7 6 5 4 3 2 1 0 cnmdata6m mdata6 7 mdata6 6 mdata6 5 mdata6 4 mdata6 3 mdata6 2 mdata6 1 mdata6 0 7 6 5 4 3 2 1 0 cnmdata7m mdata7 7 mdata7 6 mdata7 5 mdata7 4 mdata7 3 mdata7 2 mdata7 1 mdata7 0
chapter 19 can controller user?s manual u16603ej5v1ud 851 (20) cann message data length register m (cnmdlcm) the cnmdlcm register is used to set the number of bytes of the data field of a message buffer. after reset: 0000xxxxb r/w address: see table 19-16 . 7 6 5 4 3 2 1 0 cnmdlcm 0 0 0 0 mdlc3 mdlc2 mdlc1 mdlc0 mdlc3 mdlc2 mdlc1 mdlc0 data length of transmit/receive message 0 0 0 0 0 bytes 0 0 0 1 1 byte 0 0 1 0 2 bytes 0 0 1 1 3 bytes 0 1 0 0 4 bytes 0 1 0 1 5 bytes 0 1 1 0 6 bytes 0 1 1 1 7 bytes 1 0 0 0 8 bytes 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 setting prohibited (if these bits are set during transmi ssion, 8-byte data is transmitted regardless of the set dlc value when a data frame is transmitted. however, the dlc actually transmitted to the can bus is the dlc value set to this register.) note note the data and dlc value actually transmitted to can bus are as follows. type of transmit frame length of transmit data dlc transmitted data frame number of bytes specified by dlc (however, 8 bytes if dlc 8) remote frame 0 bytes mdlc3 to mdlc0 bits cautions 1. be sure to set bits 7 to 4 to 0000b. 2. receive data is stored in as many cn mdataxm register as the number of bytes (however, the upper limit is 8) correspondi ng to dlc of receive frame. the cnmdataxm register in which no data is stored is undefined.
chapter 19 can controller user?s manual u16603ej5v1ud 852 (21) cann message configuration register m (cnmconfm) the cnmconfm register is used to specify t he type of the message buffer and to set a mask. (1/2) after reset: undefined r/w address: see table 19-16 . 7 6 5 4 3 2 1 0 cnmconfm ows rtr mt2 mt1 mt0 0 0 ma0 ows overwrite control bit 0 the message buffer note that has already received a data frame is not overwritten by a newly received data frame. the newly received data frame is discarded. 1 the message buffer that has already received a data frame is overwritten by a newly received data frame. note the ?message buffer that has already received a data frame? is a receive message buffer whose the cnmctrlm.dn bit has been set to 1. remark a remote frame is received and stored, regardless of the setting of the ows and dn bits. a remote frame that satisfies the other c onditions (id matches, the rtr bit = 0, the cnmctrlm.trq bit = 0) is always received and stored in the corresponding message buffer (interrupt generated, dn flag set, the cnmd lcm.mdlc0 to cnmdlcm.mdlc3 bits updated, and recorded to the receive history list). rtr remote frame request bit note 0 transmit a data frame. 1 transmit a remote frame. note the rtr bit specifies the type of message frame that is transmitted from a message buffer defined as a transmit message buffer. even if a valid remote frame has been received, the rtr bit of the transmit message buffer that has received the frame remains cleared to 0. even if a remote frame whose id matches has been received from the ca n bus with the rtr bit of the transmit message buffer set to 1 to transmit a remote frame, that remote frame is not received or stored (interrupt generated, dn flag set, the mdlc0 to mdlc3 bits upd ated, and recorded to the receive history list). mt2 mt1 mt0 message buffer type setting bit 0 0 0 transmit message buffer 0 0 1 receive message buffer (no mask setting) 0 1 0 receive message buffer (mask 1 set) 0 1 1 receive message buffer (mask 2 set) 1 0 0 receive message buffer (mask 3 set) 1 0 1 receive message buffer (mask 4 set) other than above setting prohibited
chapter 19 can controller user?s manual u16603ej5v1ud 853 (2/2) ma0 message buffer assignment bit 0 message buffer not used. 1 message buffer used. caution be sure to write 0 to bits 2 and 1. (22) cann message id register m (cnmidlm, cnmidhm) the cnmidlm and cnmidhm registers ar e used to set an identifier (id). after reset: undefined r/w address: see table 19-16 . 15 14 13 12 11 10 9 8 cnmidlm id15 id14 id13 id12 id11 id10 id9 id8 7 6 5 4 3 2 1 0 id7 id6 id5 id4 id3 id2 id1 id0 15 14 13 12 11 10 9 8 cnmidhm ide 0 0 id28 id27 id26 id25 id24 7 6 5 4 3 2 1 0 id23 id22 id21 id20 id19 id18 id17 id16 ide format mode specification bit 0 standard format mode (id28 to id18: 11 bits) note 1 extended format mode (id28 to id0: 29 bits) note the id17 to id0 bits are not used. id28 to id0 message id id28 to id18 standard id value of 11 bits (when ide = 0) id28 to id0 extended id value of 29 bits (when ide = 1) cautions 1 be sure to write 0 to bi ts 14 and 13 of the cnmidhm register. 2. be sure to arrange the id values to be registered in accordance with the bit positions of this register. for the standard id, shif t the bit positions of id28 to id18 of the id value.
chapter 19 can controller user?s manual u16603ej5v1ud 854 (23) cann message control register m (cnmctrlm) the cnmctrlm register is used to cont rol the operation of the message buffer. (1/3) after reset: 00x000000 000xx000b r/w address: see table 19-16 . (a) read 15 14 13 12 11 10 9 8 cnmctrlm 0 0 muc 0 0 0 0 0 7 6 5 4 3 2 1 0 0 0 0 mow ie dn trq rdy (b) write 15 14 13 12 11 10 9 8 cnmctrlm 0 0 0 0 set ie 0 set trq set rdy 7 6 5 4 3 2 1 0 0 0 0 clear mow clear ie clear dn clear trq clear rdy (a) read muc note bit indicating that message buffer data is being updated 0 the can module is not updating the me ssage buffer (reception and storage). 1 the can module is updating the message buffer (reception and storage). note the muc bit is undefined until the firs t reception and storage is performed. mow message buffer overwrite status bit 0 the message buffer is not overwritt en by a newly received data frame. 1 the message buffer is overwritten by a newly received data frame. remark the mow bit is not set to 1 even if a remote frame is received and stored in the transmit message buffer with the dn bit = 1. ie message buffer interrupt request enable bit 0 receive message buffer: valid message reception completion interrupt disabled. transmit message buffer: normal message transmission completion interrupt disabled. 1 receive message buffer: valid message reception completion interrupt enabled. transmit message buffer: normal messa ge transmission completion interrupt enabled. dn message buffer data update bit 0 a data frame or remote frame is not stored in the message buffer. 1 a data frame or remote frame is stored in the message buffer.
chapter 19 can controller user?s manual u16603ej5v1ud 855 (2/3) trq message buffer transmission request bit 0 no message frame transmitting request that is pe nding or being transmitted is in the message buffer. 1 the message buffer is holding transmission of a me ssage frame pending or is transmitting a message frame. caution do not set the trq bit and rdy bit to 1 at the same time. be sure to set the rdy bit to 1 before setting the trq bit to 1. rdy message buffer ready bit 0 the message buffer can be written by software. the can module cannot write to the message buffer. 1 writing the message buffer by software is ignored (e xcept a write access to the rdy, trq, dn, and mow bits). the can module can write to the message buffer. cautions 1. do not clear (0) the rdy bit durin g message transmission. follow transmission abort procedures in order to clear the rdy bit for redefinition. 2. if the rdy bit is not cleared (0) even wh en the processing to clear it is executed, execute the clearing processing again. 3. confirm, by reading the rdy bit again, that the rdy bi t has been cleared (0) before writing data to the message buffer. however, it is unnecessary to confirm that th e trq or rdy bit has been set (1) or that the dn or mow bit has been cleared (0). (b) write clear mow setting of mow bit 0 mow bit is not changed. 1 mow bit is cleared to 0. set ie clear ie setting of ie bit 0 1 ie bit is cleared to 0. 1 0 ie bit is set to 1. other than above ie bit is not changed. caution be sure to set the ie and rdy bits separately. clear dn setting of dn bit 1 dn bit is cleared to 0. 0 dn bit is not changed. caution do not set the dn bit to 1 by softw are. be sure to write 0 to bit 10.
chapter 19 can controller user?s manual u16603ej5v1ud 856 (3/3) set trq clear trq setting of trq bit 0 1 trq bit is cleared to 0. 1 0 trq bit is set to 1. other than above trq bit is not changed. caution even if the trq bit is set (1), transmission may not be immediately executed depending on the situation such as when a message is received from another node or when a message is transmitted from the message buffer. transmission under execution is not terminated midway even if the tr q bit is cleared. transmission is continued until it is completed (regardl ess of whether it is executed successfully or fails). set rdy clear rdy setting of rdy bit 0 1 rdy bit is cleared to 0. 1 0 rdy bit is set to 1. other than above rdy bit is not changed. caution be sure to set the trq and rdy bits separately.
chapter 19 can controller user?s manual u16603ej5v1ud 857 19.7 bit set/clear function the can control registers include registers whose bits can be set or cleared via the cpu and via the can interface. an operation error occurs if the following registers are written directly. do not write any values directly via bit manipulation, read/modify/write, or direct writing of target values. ? cann global control register (cngmctrl) ? cann global automatic block transmission control register (cngmabt) ? cann module control register (cnctrl) ? cann module interrupt enable register (cnie) ? cann module interrupt status register (cnints) ? cann module receive history list register (cnrgpt) ? cann module transmit history list register (cntgpt) ? cann module time stamp register (cnts) ? cann message control register (cnmctrlm) remark n = 0, 1 m = 00 to 31 all the 16 bits in the above registers can be read via t he usual method. use the procedure described in figure 19- 25 below to set or clear the lower 8 bits in these registers. setting or clearing of lower 8 bits in the above registers is performed in combination with the higher 8 bits (see the bit status after set/clear operation is specified in figure 19 -26). figure 19-25 shows how the values of set bits or clear bits relate to set/clear/no change operations in the corresponding register.
chapter 19 can controller user?s manual u16603ej5v1ud 858 figure 19-25. example of bi t setting/clearing operations 0000000011010001 0000101111011000 set00001011 0000000000000011 clear 11011000 set no change clear bit status register?s current value write value register?s value after write operation clear clear no change no change set figure 19-26. bit status after bit setting/clearing operations set 7 clear 7 clear 6 clear 5 clear 4 clear 3 clear 2 clear 1 clear 0 set 6 set 5 set 4 set 3 set 2 set 1 set 0 set n 0 0 1 1 clear n 0 1 0 1 status of bit n after bit set/clear operation no change 0 1 no change remark n = 0 to 7
chapter 19 can controller user?s manual u16603ej5v1ud 859 19.8 can controller initialization 19.8.1 initialization of can module before can module operation is enabled, the can modu le system clock needs to be determined by setting the cngmcs.ccp0 to cngmcs.ccp3 bits by software. do not change the setting of the can module system clock after can module operation is enabled. the can module is enabled by setting the cngmctrl.gom bi t. for the procedure of in itializing the can module, see 19.16 operation of can controller. remark n = 0, 1 19.8.2 initialization of message buffer after the can module is enabled, the message buffers cont ain undefined values. a minimum initialization for all the message buffers, even for those not used in the applicat ion, is necessary before switching the can module from the initialization mode to on e of the operation modes. ? clear the cnmctrlm.rdy, cnmctrlm.trq, and cnmctrlm.dn bits to 0. ? clear the cnmconfm.ma0 bit to 0. remark n = 0, 1 m = 00 to 31 19.8.3 redefinition of message buffer redefining a message buffer means changing the id a nd control information of the message buffer while a message is being received or transmitted, without a ffecting other transmissi on/reception operations. (1) to redefine message buffe r in initialization mode place the can module in the initialization mode once a nd then change the id and control information of the message buffer in the initialization mode. after c hanging the id and control information, set the can module to an operation mode. (2) to redefine message buffer during reception perform redefinition as shown in figure 19-39.
chapter 19 can controller user?s manual u16603ej5v1ud 860 (3) to redefine message buffer during transmission to rewrite the contents of a transmit message buffer to which a transmission request has been set, perform transmission abort processing (see 19.10.4 (1) transmission abort process other than in normal operation mode with automatic block transmission (abt), 19.10.4 (2) tran smission abort process except for abt transmission in normal operation mode with automatic bl ock transmission (abt) ). confirm that transmission has been aborted or comp leted, and then redefine the message buffer. after redefining the transmit message buffer, set a transmissio n request using the procedure described below. when setting a transmission request to a message buffer that has been redef ined without aborting the transmission in progress, however, the 1-bit wait time is not necessary. figure 19-27. setting transmission request (trq) to transmit message buffer after redefinition execute transmission? wait for a period of 1 can data bit. set trq bit set trq bit = 1 clear trq bit = 0 yes no redefinition completed end cautions 1. when a message is received, reception fi ltering is performed in accordance with the id and mask set to each receive messag e buffer. if the procedure in figure 19-39 is not observed, the contents of the message buffer after it has been redefined may cont radict the result of reception (result of reception filtering). if th is happens, check that the id and ide received first and stored in the messag e buffer following redefinition are those stored after the message buffer has been redefined. if no id and ide are stored after redefinition, redefine the message buffer again. 2. when a message is transmi tted, the transmission priority is checked in accordance with the id, ide, and rtr bits set to each transmit message buffer to which a transmission request was set. the transmit message buffer havi ng the highest priority is selected for transmission. if the procedure in figure 19-27 is not observed, a message with an id not having the highest priority may be transmitted afte r redefinition.
chapter 19 can controller user?s manual u16603ej5v1ud 861 19.8.4 transition from initializat ion mode to operation mode the can module can be switched to the following operation modes. ? normal operation mode ? normal operation mode with abt ? receive-only mode ? single-shot mode ? self-test mode figure 19-28. transiti on to operation modes can module channel invalid [receive-only mode] opmode[2:0] = 03h opmode[2:0] = 00h and can bus is busy. opmode[2:0] = 03h [single-shot mode] opmode[2:0] = 04h opmode[2:0] = 04h opmode[2:0] = 05h init mode opmode[2:0] = 00h efsd = 1 and gom = 0 all can modules are in init mode and gom = 0 gom = 1 reset reset released [normal operation mode with abt] opmode[2:0] = 02h opmode[2:0] = 00h and can bus is busy. opmode[2:0] = 00h and interframe space opmode[2:0] = 02h opmode[2:0] = 01h opmode[2:0] = 00h and can bus is busy. [normal operation mode] opmode[2:0] = 01h opmode[2:0] = 00h and can bus is busy. opmode[2:0] = 00h and interframe space opmode[2:0] = 00h and interframe space opmode[2:0] = 00h and interframe space opmode[2:0] = 00h and interframe space opmode[2:0] = 00h and can bus is busy. [self-test mode] opmode[2:0] = 05h the transition from the in itialization mode to an operation mode is controlled by the cnctrl.opmode2 to cnctrl.opmode0 bits. changing from one operation mode into another requires sh ifting to the initialization mode in between. do not change one operation mode to another directly; otherwise the operation will not be guaranteed. requests for transition from an operation mode to the in itialization mode are held pending when the can bus is not in the interframe space (i.e., frame reception or tr ansmission is in progress), and the can module enters the initialization mode at the first bit in the interframe space (the values of the opmode2 to opmode0 bits are changed to 000b). after issuing a request to change the mode to the initialization mode, read the opmode2 to opmode0 bits until their values become 000b to confirm that the module has entered the initialization mode (see figure 19-37 ). remark n = 0, 1 19.8.5 resetting error counter cnerc of can module if it is necessary to reset the cnerc and cninfo register s when re-initialization or forced recovery from the bus- off status is made, set the cnctrl.ccerc bit to 1 in the initialization mode. when this bit is set to 1, the cnerc and cninfo registers are cleared to their default values. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 862 19.9 message reception 19.9.1 message reception all buffers satisfying the following conditions are searched in all the message buffer areas in all the operation modes in order to store newly receive messages. ? used as a message buffer (cnmconfm.ma0 bit is set to 1.) ? set as a receive message buffer (cnmconfm.mt2 to cnmconfm.mt0 bits ar e set to 001b, 010b, 011b, 100b, or 101b.) ? ready for reception (cnmctrlm.rdy bit is set to 1.) remark n = 0, 1 m = 00 to 31 when two or more message buffers of the can module receive a message, the message is stored according to the priority explained below. the message is always stored in the message buffer with the highest priority, not in a message buffer with a low priority. for example, when an unmasked receive message buffer and a receive message buffer linked to mask 1 have the same id, the received message is not stored in the message buffer linked to mask 1 that has not received a message, even if a message has already been received in the unmasked receive message buffer. in other words, when a condition has been set to store a message in two or more message buffers with different priorities, the message buffer with the highest prio rity always stores the message; the message is not stored in message buffers with a lower priority. this also applies when the message buffer with the highest priority is unable to receive and store a message (i.e., when the dn bit = 1 i ndicating that a message has already been received, but rewriting is disabled because the ows bit = 0). in this case, the message is not actually received and stored in the candidate message buffer with the highest priority, but neither is it stored in a message buffer with a lower priority. priority storing condition if same id is set dn bit = 0 1 (high) unmasked message buffer dn bit = 1 and ows bit = 1 dn bit = 0 2 message buffer linked to mask 1 dn bit = 1 and ows bit = 1 dn bit = 0 3 message buffer linked to mask 2 dn bit = 1 and ows bit = 1 dn bit = 0 4 message buffer linked to mask 3 dn bit = 1 and ows bit = 1 dn bit = 0 5 (low) message buffer linked to mask 4 dn bit = 1 and ows bit = 1
chapter 19 can controller user?s manual u16603ej5v1ud 863 19.9.2 reading reception data if it is necessary to consistently read data from t he can message buffer by software, follow the recommended procedures shown in figures 19-49 and 19-50. while receiving a message, the can module sets the cn mctrlm.dn bit two times, at the beginning of the processing to store data in the message buffer and at t he end of this storing processing. during this storing processing, the cnmctrlm.muc bit of the message buffer is set (1) (see figure 19-29 ). before the data is completely stored, the receive history li st is written. during this data storing period (muc bit = 1), the cpu is prohibited from rewriting the cnmctrlm.rdy bit of the message buffer in which the data is to be stored. completion of this data storing processing ma y be delayed by a cpu?s a ccess to any message buffer. remark n = 0, 1 m = 0 to 31 figure 19-29. dn and muc bit setting period (in standard id format) sof (1) id ide rtr r0 dlc data0 to data7 crc ack eof can standard id format (11) (1) (1) (1) (4) (0 to 64) (16) (2) recessive dominant dn bit muc bit message stored data, dlc, id message buffer (7) the dn bit is set (1) and the muc bit is cleared (0) at the same time. cnints.cints1 bit the dn and muc bits are set (1) at the same time. ifs intcnrec signal operation of can controller
chapter 19 can controller user?s manual u16603ej5v1ud 864 19.9.3 receive history list function the receive history list (rhl) function records in the re ceive history list the number of the receive message buffer in which each data frame or remote frame was received and stored. the rhl consists of storage elements equivalent to up to 23 messages, the last in-me ssage pointer (lipt) with the correspo nding cnlipt register and the receive history list get pointer (rgpt) with t he corresponding cnrgpt register. the rhl is undefined immediately after the transition of the can module from the initialization mode to one of the operation modes. the cnlipt register holds the contents of the rhl element i ndicated by the value of the lipt pointer minus 1. by reading the cnlipt register, therefore, the number of t he message buffer that received and stored a data frame or remote frame first can be checked. the lipt pointer is utilized as a write pointer that indicates to what part of the rhl a message buffer number is recorded. any time a dat a frame or remote frame is received and stored, the corresponding message buffer num ber is recorded to the rhl element indicated by the lipt pointer. each time recording to the rhl has been completed, the lipt pointer is automatically incremented. in this way, the number of the message buffer that has received and stored a frame will be recorded chronologically. the rgpt pointer is utilized as a read pointer that reads a recorded message buffer number from the rhl. this pointer indicates the first rhl element that the cpu has not read yet. by readi ng the cnrgpt register by software, the number of a message buffer that has re ceived and stored a data frame or remote frame can be read. each time a message buffer number is read from the cnrgpt regist er, the rgpt pointer is automatically incremented. if the value of the rgpt pointer matches the value of th e lipt pointer, the cnrgpt.rhp m bit (receive history list pointer match) is set to 1. this indicates that no me ssage buffer number that has not been read remains in the rhl. if a new message buffer number is recorded, the lipt poi nter is incremented and because its value no longer matches the value of the rgpt pointer, the rhpm bit is cleared. in other words, the numbers of the unread message buffers exist in the rhl. if the lipt pointer is incremented and matches the valu e of the rgpt pointer minus 1, the cnrgpt.rovf bit (receive history list overflow) is set to 1. this indicates th at the rhl is full of numbers of message buffers that have not been read. when further message reception and stori ng occur, the last recorded message buffer number is overwritten by the number of the messa ge buffer that received and stored the new message. after the rovf bit has been set to 1, the recorded message buffer numbers in the rhl do not completely reflect chronological order. however the messages themselves are not lost and can be located by a cpu search in the message buffer memory with the help of the dn bit. caution even if the receive history list overflows (cnrgpt.rovf bit = 1) , the receive history can be read until no more history is left unread and the cnrgpt.rhpm bit is set (1). however, the rovf bit is kept set (1) (= overflow occurs) until cleared (0) by software. in this status, the rhpm bit is not cleared (0), unless the rovf bit is cleared (0), even if a new receive history is stored and written to the list. if rovf bit = 1 and rhpm bit = 1 and the receive history list overflows, therefore, the rhpm bit indicates that no more hi story is left unread even if new history is received and stored. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 865 as long as the rhl contains 23 or less entries the sequence of occurrence is maintained. if more receptions occur without the rhl being read by the host processor, a comp lete sequence of receptions can not be recovered. figure 19-30. receive history list last in- massage pointer (lipt) receive history list get pointer (rgpt) ? message buffer 6, 9, 2, and 7 are read by host processor. ? newly received messages are stored in message buffer 3, 4, and 8. event: receive history list get pointer (rgpt) last in- massage pointer (lipt) ? 20 other massages are received. message buffer 6 carries last received message. ? upon reception in message buffer 6, rhl is full. ? rovf bit is set to 1. event: last in- massage pointer (lipt) last in- massage pointer (lipt) receive history list get pointer (rgpt) receive history list get pointer (rgpt) receive history list (rhl) message buffer 6 message buffer 9 message buffer 2 message buffer 7 0 1 2 3 4 5 6 7 22 23 : : : receive history list (rhl) message buffer 3 message buffer 4 message buffer 8 0 1 2 3 4 5 6 7 22 23 : : : receive history list (rhl) message buffer 10 message buffer 11 message buffer 6 message buffer 3 message buffer 4 message buffer 8 message buffer 5 message buffer9 message buffer1 0 1 2 3 4 5 6 7 22 23 : : : ? reception in message buffer13, 14, and 15 occurs. ? overflow situation occurs. event: receive history list (rhl) message buffer 10 message buffer 11 message buffer 15 message buffer 3 message buffer 4 message buffer 8 message buffer 5 message buffer 9 message buffer 1 0 1 2 3 4 5 6 7 22 23 : : : rovf bit = 1 lipt is blocked rovf bit = 1 lipt is blocked rovf bit = 1 denotes that lipt equals rgpt - 1 while message buffer number stored to element indicated by lipt ? 1.
chapter 19 can controller user?s manual u16603ej5v1ud 866 19.9.4 mask function for some message buffers that are used for reception, wh ether one of four global reception masks is applied can be selected. load resulting from comparing message identifiers is re duced by masking some bits, and, as a result, some different identifiers can be received in a buffer. by using the mask function, the identifier of a messa ge received from the can bus can be compared with the identifier set to a message buffer in advance. regardless of whether the masked id is set to 0 or 1, the received message can be stored in the defined message buffer. while the mask function is in effect, an identifier bit that is defined to be 1 by a mask in the received message is not compared with the corresponding ident ifier bit in the message buffer. however, this comparison is performed for any bi t whose value is defined as 0 by the mask. for example, let us assume that all messages that have a standard-format id, in which bits id27 to id25 are 0 and bits id24 and id22 are 1, are to be stored in message bu ffer 14. the procedure for this example is shown below. <1> identifier to be stored in message buffer id28 id27 id26 id25 id24 id23 id22 id21 id20 id19 id18 x 0 0 0 1 x 1 x x x x remark x = don?t care <2> identifier to be configured in message buffer 14 (example) (using c0midl14 and c0midh14 registers) id28 id27 id26 id25 id24 id23 id22 id21 id20 id19 id18 x 0 0 0 1 x 1 x x x x id17 id16 id15 id14 id13 id12 id11 id10 id9 id8 id7 x x x x x x x x x x x id6 id5 id4 id3 id2 id1 id0 x x x x x x x id with the id27 to id25 bits cleared to 0 and the id24 and id22 bits set to 1 is registered (initialized) to message buffer 14. remark x = don?t care remarks 1. message buffer 14 is set as a standard format ident ifier that is linked to mask 1 (cnmconf14.mt2 to cnmconf14.mt0 bits are set to 010b). 2. n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 867 <3> mask setting for can module 1 (mask 1) (example) (using can1 module mask 1 registers l and h (c1mask1l and c1mask1h)) cmid28 cmid27 cmid26 cmid25 cmid24 cmid23 cmid22 cmid21 cmid20 cmid19 cmid18 1 0 0 0 0 1 0 1 1 1 1 cmid17 cmid16 cmid15 cmid14 cmid13 cmid12 cmid11 cmid10 cmid9 cmid8 cmid7 1 1 1 1 1 1 1 1 1 1 1 cmid6 cmid5 cmid4 cmid3 cmid2 cmid1 cmid0 1 1 1 1 1 1 1 1: not compared (masked) 0: compared the cmid27 to cmid24 and cmid22 bits are clear ed to 0, and the cmid28, cmid23, and cmid21 to cmid0 bits are set to 1.
chapter 19 can controller user?s manual u16603ej5v1ud 868 19.9.5 multi buffer receive block function the multi buffer receive block (mbrb) function is used to store a block of data in two or more message buffers sequentially with no cpu interaction, by setting the same id to two or more message buffers with the same message buffer type. these message buffers can be allocated in any area in the message buffer memory, and they are not necessarily to be allocated adjacent to each other. suppose, for example, the same message buffer type is se t to 10 message buffers, message buffers 10 to 19, and the same id is set to each message buffer. if the firs t message whose id matches an id of the message buffers is received, it is stored in message buffer 10. at this point, th e dn bit of message buffer 10 is set, prohibiting overwriting the message buffer. when the next message with a matching id is received, it is received and stored in message buffer 11. each time a message with a matching id is received, it is sequentially (in the ascending order) stored in message buffers 12, 13, and so on. even when a data block consisting of multiple messages is received, the messages can be stored and received without overwriting the prev iously received matching-id data. whether a data block has been received and stored can be checked by setting the cnmctrlm.ie bit of each message buffer. for example, if a data block consists of k messages, k message buffers are initialized for reception of the data block. the ie bit in message buffers 0 to (k-2 ) is cleared to 0 (interrupts disabled), and the ie bit in message buffer k-1 is set to 1 (interrupts enabled). in th is case, a reception completion interrupt occurs when a message has been received and stored in message buffer k-1, indicating that mbrb has become full. alternatively, by clearing the ie bit of message buffers 0 to (k-3) and setti ng the ie bit of message buffer k-2, a warning that mbrb is about to overflow can be issued. the basic conditions of storing receive data in each message buffer for the mbrb are the same as the conditions of storing data in a single message buffer. cautions 1. mbrb can be configured for each of the same message buffer types. therefore, even if a message buffer of another mbrb whose id ma tches but whose message buffer type is different has a vacancy, the rece ived message is not stored in that message buffer, but instead discarded. 2. mbrb does not have a ring buffer structure. therefore, after a message is stored in the message buffer having the highest number in the mbrb configuration, a newly received message will no longer be stored in the message buffer in the order from the lowest message buffer number. 3. mbrb operates based on the reception and storage conditions; there are no settings dedicated to mbrb, such as function enable bi ts. by setting the same message buffer type and id to two or more message buffe rs, mbrb is automati cally configured. 4. with mbrb, ?matching id? means ?matching id after mask?. even if the id set to each message buffer is not the same, if the id that is masked by the mask register matches, it is considered a matching id and the buffer that has this id is treat ed as the stor age destination of a message. 5. priority among each mbrb conforms to the priority shown in 19.9. 1 message reception. remark n = 0, 1 m = 00 to 31
chapter 19 can controller user?s manual u16603ej5v1ud 869 19.9.6 remote frame reception in all the operation modes, when a remote frame is receiv ed, the message buffer that is to store the remote frame is searched from all the message buffers satisfying the following conditions. ? used as a message buffer (cnmconfm.ma0 bit set to 1.) ? set as a transmit message buffer (cnmconfm.mt2 to cnmconfm.mt0 bits set to 000b) ? ready for reception (cnmctrlm.rdy bit set to 1.) ? set to transmit message (cnmconfm.rtr bit is cleared to 0.) ? transmission request is not set. (cnmctrlm.trq bit is cleared to 0.) upon acceptance of a remote frame, the following actions are executed if the id of the received remote frame matches the id of a message buffer that satisfies the above conditions. ? the cnmdlcm.dlc3 to cnmdlcm.dlc0 bits store the received dlc value. ? the cnmdata0m to cnmdata7m registers in the data ar ea are not updated (data before reception is saved). ? the cnmctrlm.dn bit is set to 1. ? the cnints.cints1 bit is set to 1 (if the cnmctrlm.ie bit of the message buffer that receives and stores the frame is set to 1). ? the reception completion interrupt (i ntcnrec) is output (if the ie bit of the message buffer that receives and stores the frame is set to 1 and if the cnie.cie1 bit is set to 1). ? the message buffer number is recorded in the receive history list. caution when a message buffer is searched for receivi ng and storing a remote frame, overwrite control by the cnmconfm.ows bit of the message buffer and the dn bit are not affected. the setting of the ows bit is ignored and the dn bit is set to 1 in every case. if more than one transmit message buffer has the same id and the id of the received remote frame matches that id, the remote frame is stor ed in the transmit messag e buffer with the lowest message buffer number. remark n = 0, 1 m = 00 to 31
chapter 19 can controller user?s manual u16603ej5v1ud 870 19.10 message transmission 19.10.1 message transmission in all the operation modes, if the cnmc trlm.trq bit is set to 1 in a messa ge buffer that sati sfies the following conditions, the message buffer that is to transmit a message is searched. ? used as a message buffer (cnmconfm.ma0 bit set to 1.) ? set as a transmit message buffer (cnmconfm.mt2 to cnmconfm.mt0 bits set to 000b.) ? ready for transmission (cnmctrlm.rdy bit is set to 1.) remark n = 0, 1 m = 00 to 31 the can system is a multi-master communication system. in a system like this, the priority of message transmission is determined based on message identifiers (ids). to facilitate transmission processing by software when there are several messages awaiting transmission, t he can module uses hardware to check the id of the message with the highest priority and automatically identifies that message. this eliminates the need for software- based priority control. transmission priority is controlled by the identifier (id). figure 19-31. message processing example message no. the can module transmits messages in the following sequence. message waiting to be transmitted id = 120h id = 229h id = 223h id = 023h id = 123h 0 1 2 3 4 5 6 7 8 9 1. message 6 2. message 1 3. message 8 4. message 5 5. message 2 after the transmit message search, the transmit message with the highest priority of the transmit message buffers that have a pending transmission request (message buffers with the trq bit set to 1 in advance) is transmitted. if a new transmission request is set, the transmit message buffer with the new transmission request is compared with the transmit message buffer with a pending transmission request. if the new transmission request has a higher priority, it is transmitted, unless transmission of a message wit h a low priority has already started. to solve this reversal of priorities, software can request that transmi ssion of a message of low prio rity be stopped. the highest priority is determined according to the following rules.
chapter 19 can controller user?s manual u16603ej5v1ud 871 priority conditions description 1 (high) value of first 11 bits of id [id28 to id18]: the message frame with the lowest value represented by the first 11 bits of the id is transmitted first. if the value of an 11- bit standard id is equal to or smaller than the first 11 bits of a 29-bit extended id, the 11-bit standard id has a higher priority than a message frame with a 29-bit extended id. 2 frame type a data frame with an 11-bit standard id (cnmconfm.rtr bit is cleared to 0) has a higher priority than a remote frame with a standard id and a message frame with an extended id. 3 id type a message frame with a standard id (cnmi dhm.ide bit is cleared to 0) has a higher priority than a message frame with an extended id. 4 value of lower 18 bits of id [id17 to id0]: if one or more transmission-pending ex tended id message frame has equal values in the first 11 bits of the id and the same frame type (equal rtr bit values), the message frame with the lowest value in the lower 18 bits of its extended id is transmitted first. 5 (low) message buffer number if two or more message buffers request tr ansmission of message frames with the same id, the message from the message buffer with the lowest message buffer number is transmitted first. remarks 1. if the automatic block transmission request bit cngmabt.abttrg bit is set to 1 in the normal operation mode with abt, the trq bit is set to 1 only for one message buffer in the abt message buffer group. if the abt mode was triggered by the abttrg bit (1), one trq bit is set to 1 in the abt area (buffers 0 to 7). in addition to this trq bit, t he application can request transmissions (set trq bit to 1) for other tx-message buffers that do not belong to the abt area. in that case an internal arbitration process (tx-search) evaluates all of the tx-message buffers with the trq bit set to 1 and chooses the message buffer that contains t he highest prioritized identifier for the next transmission. if there are 2 or more identifiers that have the highest priority (i.e. identical identifiers), the message located at the lowest message buffer number is transmitted first. upon successful transmission of a message fr ame, the following operations are performed. ? the trq bit of the corresponding transmit me ssage buffer is automatically cleared to 0. ? the transmission completion status bit cints0 of t he cnints register is set to 1 (if the interrupt enable bit (ie) of the corresponding transmit message buffer is set to 1). ? an interrupt request signal intcntrx is output (if the cnie.cie0 bit is set to 1 and if the interrupt enable bit (ie) of the corresponding transmit message buffer is set to 1). 2. before changing the contents of the transmit me ssage buffer, the rdy flag of this buffer must be cleared. since the rdy flag may be temporarily lock ed while the internal processing is changed, it is necessary to check the status of the rdy flag after changing the buffer contents. 3. n = 0, 1 m = 0 to 31
chapter 19 can controller user?s manual u16603ej5v1ud 872 19.10.2 transmit history list function the transmit history list (thl) function records in the tr ansmit history list the number of the transmit message buffer in which each data frame or remote frame was received an d stored. the thl consists of storage elements equivalent to up to seven messages, the last out-message pointer (l opt) with the corresponding cnlopt register, and the transmit history list get pointer (tgpt) with the corresponding cntgpt register. the thl is undefined immediately after t he transition of the can module from t he initialization mode to one of the operation modes. the cnlopt register holds t he contents of the thl element indicated by the value of the lopt pointer minus 1. by reading the cnlopt register, theref ore, the number of the message buffer t hat transmitted a data frame or remote frame first can be checked. the lopt poi nter is utilized as a write pointer that indicates to what part of the thl a message buffer number is reco rded. any time a data frame or remote frame is transmitted, the corresponding message buffer number is recorded to the thl element indica ted by the lopt pointer. each time recording to the thl has been completed, the lopt pointer is automatically incremented. in this way, the number of the message buffer that has received and stored a frame will be recorded chronologically. the tgpt pointer is utilized as a read pointer that reads a recorded message buffer number from the thl. this pointer indicates the first thl element that the cpu has not yet read. by reading the cn tgpt register by software, the number of a message buffer that has completed transmissi on can be read. each time a message buffer number is read from the cntgpt register, the tg pt pointer is automatically incremented. if the value of the tgpt pointer matches the value of the lopt pointer, the cntgpt.thpm bit (transmit history list pointer match) is set to 1. this indicates that no mess age buffer numbers that have not been read remain in the thl. if a new message buffer number is recorded, the lopt poi nter is incremented and because its value no longer matches the value of the tgpt pointer, the thpm bit is cleared. in other words, the numbers of the unread message buffers exist in the thl. if the lopt pointer is incremented and matches the value of the tgpt point er minus 1, the cntgpt.tovf bit (transmit history list overflow) is set to 1. this indica tes that the thl is full of message buffer numbers that have not been read. if a new message is receiv ed and stored, the message buffer number recorded last is overwritten by the number of the message buffer that received and stored t he new message. after the tovf bit has been set (1), therefore, the recorded message buffer nu mbers in the thl do not completely reflect chronological order. however the transmitted messages can be found by a cpu search ap plied to all transmit message buffers unless the cpu has not overwritten a transmit object in one of these buffers be forehand. in total up to six transmission completions can occur without overflowing the thl. caution even if the transmit hist ory list overflows (cntgpt.tovf bit = 1), the transmit history can be read until no more history is left unread and the cntgpt.thpm bit is set (1 ). however, the tovf bit is kept set (1) (= overflow occu rs) until cleared (0) by software. in this status, the thpm bit is not cleared (0), unless the tovf bi t is cleared (0), even if a new transmit history is stored and written to the list. if the tovf bit = 1 and the th pm bit = 1 and the transmit history list overflows, therefore, the thpm bit indicates that no more hi story is left unread ev en if new history is received and stored. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 873 figure 19-32. transmit history list last out- message pointer (lopt) ? cpu confirms tx completion of message buffer 6, 9, and 2. ? tx completion of message buffer 3, and 4. event: transmit history list get pointer (tgpt) ? message buffer 8, 5, 6, and 10 completes transmission. ? thl is full. ? tovf bit is set to 1. event: transmit history list (thl) message buffer 6 message buffer 9 message buffer 2 message buffer 7 0 1 2 3 4 5 6 7 ? message buffer11, 13, and 14 completes transmission. ? overflow situation occurs. event: tovf bit = 1 lopt is blocked tovf bit = 1 lopt is blocked tovf bit = 1 denotes that lopt equals tg pt - 1 while message buffer number st ored to element indicated by lopt - 1. last out- message pointer (lopt) transmit history list get pointer (tgpt) transmit history list (thl) message buffer 7 message buffer 3 message buffer 4 0 1 2 3 4 5 6 7 transmit history list (thl) message buffer 6 message buffer 10 message buffer 7 message buffer 3 message buffer 4 message buffer 8 message buffer 5 0 1 2 3 4 5 6 7 last out- message pointer (lopt) transmit history list get pointer (tgpt) transmit history list (thl) message buffer 6 message buffer 14 message buffer 7 message buffer 3 message buffer 4 message buffer 8 message buffer 5 0 1 2 3 4 5 6 7 last out- message pointer (lopt) transmit history list get pointer (tgpt)
chapter 19 can controller user?s manual u16603ej5v1ud 874 19.10.3 automatic blo ck transmission (abt) the automatic block transmission (abt) function is used to transmit two or more data frames successively with no cpu interaction. the maximum number of transmit messa ge buffers assigned to the abt function is eight (message buffer numbers 0 to 7). by setting the cnctrl.opmode2 to cnctrl.opmode0 bits to 010b, ?normal operation mode with automatic block transmission function? (hereafter referred to as abt mode) can be selected. to issue an abt transmission request, define the message buffe rs by software first. set the cnmconfm.ma0 bit (1) in all the message buffers used for abt, and define all the buffers as transmit message buffers by setting the cnmconfm.mt2 to cnmconfm.mt0 bits to 000b. be sure to set the id used in the message buffer for abt for each message buffer, even when that id is being used for all t he message buffers. to use two or more ids, set the id of each message buffer by using the cnmidlm and cnmidhm registers. set the cnmdlcm and cnmdata0m to cnmdata7m registers before issuing a tr ansmission request for the abt function. after initialization of message buffers fo r abt is finished, the cnmctrlm.rdy bit needs to be set (1). in the abt mode, the cnmctrlm.trq bit does not have to be manipulated by software. after the data for the abt message buffers has been pre pared, set the cngmabt.abttr g bit to 1. automatic block transmission is then started. w hen abt is started, the trq bit in the first message buffer (message buffer 0) is automatically set to 1. after transmi ssion of the data of message buffer 0 is fi nished, the trq bit of the next message buffer, message buffer 1, is set aut omatically. in this way, transmission is executed successively. a delay time can be inserted by program in the interval in which the transmission request (trq bit) is automatically set while successive transmission is being executed. th e delay time to be inserted is defined by the cngmabtd register. the unit of the delay time is dbt (data bit time). dbt depends on the setting of the cnbrp and cnbtr registers. during abt, the priority of the transmission id is not searched in the abt transmit message buffer. the data of message buffers 0 to 7 is sequentially transmitted. when transmission of the data frame from message buffer 7 has been completed, the abttrg bit is automatically cleared to 0 and the abt operation is finished. if the rdy bit of an abt message buffer is cleared during abt, no data frame is transmitt ed from that buffer, abt is stopped, and the abttrg bit is clear ed. after that, transmission can be resumed from the message buffer where abt stopped, by setting the rdy and abttrg bits to 1 by so ftware. to not resume transmission from the message buffer where abt stopped, the internal abt engine can be rese t by setting the cngmabt.abtclr bit to 1 while abt mode is stopped and the abttrg bit is cleared to 0. in this case, transmission is started from message buffer 0 if the abtclr bit is cleared to 0 and then the abttrg bit is set to 1. an interrupt can be used to check if data frames have b een transmitted from all the message buffers for abt. to do so, the cnmctrlm.ie bit of each message buffer except the last message buffer needs to be cleared (0). if a transmit message buffer other than those used by the abt function (message buffers 8 to 31) is assigned to a transmit message buffer, the priority of the message to be tr ansmitted is determined by the priority of the transmission id of the abt message buffer whose transmission is curr ently held pending and the transmission message buffer of the message buffers other than t hose used by the abt function. transmission of a data frame from an abt message buffer is not recorded in the transmit history list (thl).
chapter 19 can controller user?s manual u16603ej5v1ud 875 cautions 1. to resume the normal operation mode with abt from the message buffer 0, set the abtclr bit to 1 while the abttrg bit is cleared to 0. if th e abtclr bit is set to 1 while the abttrg bit is set to 1, the sub sequent operation is not guaranteed. 2. whether the automatic blo ck transmission engine is cleared by setting the abtclr bit to 1 can be confirmed if the abtclr bit is au tomatically cleared immediately after the processing of the clearing request is completed. 3. do not set the abttrg bit in the initialization mode. if the abttrg bit is set in the initialization mode, the proper operation is not guaranteed afte r the mode is changed from the initialization mode to the abt mode. 4. do not set the trq bit of the abt message buffers to 1 by software in the normal operation mode with abt. otherwise, the operation is not guaranteed. 5. the cngmabtd register is used to set the delay time that is inserted in the period from completion of the preceding abt message to setting of the trq bi t for the next abt message when the transmissi on requests are set in the order of message numbers for each message for abt that is successively transmitted in the abt mode. the timing at which the messages are actually transmitte d onto the can bus vari es depending on the status of transmission from othe r stations and the status of the setting of the transmission request for messages other than the abt messages (message buffers 8 to 31). 6. if a transmission request is made for a message other than an abt message and if no delay time is inserted in the interval in which transmission requests for abt are automatically set (cngmabtd register = 00h ), messages other than abt messages may be transmitted regardless of their priori ty in regards to the abt message. 7. do not clear the rdy bit to 0 when the abttrg bit = 1. 8. if a message is received from another node in the normal operation mode with abt, the message may be transmitted after the time of one frame has elapsed even when cngmabtd register = 00h. remark n = 0, 1 m = 00 to 31 19.10.4 transmission abort process remark n = 0, 1 m = 00 to 31 (1) transmission abort process other than in normal operation mode wit h automatic block transmission (abt) the user can clear the cnmctrlm.trq bit to 0 to abort a transmission request. the trq bit will be cleared immediately if the abort was successf ul. whether the transmission was successfully aborted or not can be checked using the cnctrl.tst at bit and the cntgpt regi ster, which indicate the transmission status on the can bus (for details, see the processing in figure 19-46). (2) transmission abort process except for abt tran smission in normal operati on mode with automatic block transmission (abt) the user can clear the cngmabt.abttrg bit to 0 to abort a transmission request. after checking the abttrg bit = 0, clear the cnmctrlm.trq bit to 0. the trq bit will be cleared immediately if the abort was successful. whether the transmission was successfu lly aborted or not can be checked by using the cnctrl.tstat bit and the cntgpt r egister, which indicate the transmission status on the can bus (for details, see the process in figure 19-47).
chapter 19 can controller user?s manual u16603ej5v1ud 876 (3) transmission abort in no rmal operation mode with automa tic block transmission (abt) to abort abt that is already start ed, clear the cngmabt.abttrg bit to 0. in this case, the abttrg bit remains 1 if an abt message is currently being tran smitted and until the transmission is completed (successfully or not), and is cleared to 0 as soon as transmission is finished. this aborts abt. if the last transmission (before abt) was successful, the normal operation mode with abt is left with the internal abt pointer pointing to the next message buffer to be transmitted. in the case of an erroneous transmissi on, the position of the internal abt pointer depends on t he status of the trq bit in the last transmitted message buffer. if the trq bit is set to 1 when clearing the abttrg bit is requested, the internal abt pointer points to the last transmitted message buffer (for details, see the process in figure 19-48 (a)). if the trq bit is cleared to 0 when clearing the abttrg bit is requested, the internal abt pointer is increased in increment s of 1 and indicates the next message buffer in the abt area (for details, see the process in figure 19-48 (b)). caution be sure to abort abt by clearing the abttrg bit to 0. the operation is not guaranteed if aborting transmission is requested by clearing rdy. when the normal operation mode with abt is resumed af ter abt has been aborted and the abttrg bit is set to 1, the next abt message buffer to be transmitt ed can be determined from the following table. status of trq of abt message buffer abort after succe ssful transmission abort a fter erroneous transmission set (1) next message buffer in the abt area note same message buffer in the abt area cleared (0) next message buffer in the abt area note next message buffer in the abt area note note the above resumption operation can be performed only if a message buffer ready for abt exists in the abt area. for example, an abort request that is issu ed while abt of message buffer 7 is in progress is regarded as completion of abt, rather than abor t, if transmission of message buffer 7 has been successfully completed, even if the abttrg bit is cleared to 0. if the cnmctrlm.rdy bit in the next message buffer in the abt area is cleared to 0, the internal abt pointer is retained, but the resumption operation is not performed even if the abttrg bi t is set to 1, and abt ends immediately. remark n = 0, 1 m = 00 to 31 19.10.5 remote frame transmission remote frames can be transmitted only from transmit mess age buffers. set whether a data frame or remote frame is transmitted via the cnmconfm.rtr bit. setting (1) the rtr bit sets remote frame transmission. remark n = 0, 1 m = 00 to 31
chapter 19 can controller user?s manual u16603ej5v1ud 877 19.11 power saving modes 19.11.1 can sleep mode the can sleep mode can be used to set the can cont roller to standby mode in order to reduce power consumption. the can module can en ter the can sleep mode from all operati on modes. release of the can sleep mode returns the can module to exactly the same oper ation mode from which the can sleep mode was entered. in the can sleep mode, the can module does not tr ansmit messages, even when transmission requests are issued or pending. (1) entering can sleep mode the cpu issues a can sleep mode transition reques t by writing 01b to the cnctrl.psmode1 and cnctrl.psmode0 bits. this transition request is only acknowledged only under the following conditions. remark n = 0, 1 (i) the can module is already in one of the following operation modes ? normal operation mode ? normal operation mode with abt ? receive-only mode ? single-shot mode ? self-test mode ? can stop mode in all the above operation modes (ii) the can bus state is bus idle (the 4th bit in the interframe space is recessive) note note if the can bus is fixed to dominant, the requ est for transition to the can sleep mode is held pending. also the transition from can stop m ode to can sleep mode is independent of the can bus state. (iii) no transmission request is pending if any one of the conditions mentioned above is not met, the can module will operate as follows. ? if the can sleep mode is request ed from the initialization mode, t he can sleep mode transition request is ignored and the can module remains in the initialization mode. ? if the can bus state is not bus idle (i.e., the can bus state is either transmitting or receiving) when the can sleep mode is requested in one of the operat ion modes, immediate transition to the can sleep mode is not possible. in this case, the can sleep mode transition request has to be held pending until the can bus state becomes bus idle (t he 4th bit in the interframe space is recessive). in the time from the can sleep mode request to successful transition, the psmode1 and psmode0 bits remain 00b. when the module has entered the can sleep mode, the psmode1 and psmode0 bits are set to 01b. ? if a request for transition to the initialization mode and a request fo r transition to the can sleep mode are made at the same time while the can module is in one of the operation modes, the request for the initialization mode is enabled. the can module enters the initialization mode at a predetermined timing. at this time, the can sleep mode request is not held pending and is ignored. ? even when the initialization mode and sleep mode are not requested simultaneously (i.e the first request was not granted when a second request was made), the request for initialization has priority over the can sleep mode request. the can sleep mode request is cancelled when the initialization mode is requested. when a pending request fo r the initialization mode is present , a subsequent request for the can sleep mode request is cancelled right at the point in time when it was submitted.
chapter 19 can controller user?s manual u16603ej5v1ud 878 (2) status in can sleep mode the can module is in one of the following states after it enters the can sleep mode. ? the internal operating clock is stopped a nd the power consumption is minimized. ? the function to detect the falling edg e of the can reception pin (crxdn) remains in effect to wake up the can module from the can bus. ? to wake up the can module from the cpu, data c an be written to the psmode1 and psmode0 bits, but nothing can be written to other cann module registers or bits. ? the cann module registers can be read, exc ept for the cnlipt, cnrg pt, cnlopt, and cntgpt registers. ? the cann message buffer register s cannot be written or read. ? cngmctrl.mbon bit is cleared to 0. ? a request for transition to the initializati on mode is not acknowledged and is ignored. remark n = 0, 1 (3) releasing can sleep mode the can sleep mode is releas ed by the following events. ? when the cpu writes 00b to the psmode1 and psmode0 bits ? a falling edge at the can reception pin (crxdn) (i.e. the can bus level shifts from recessive to dominant) cautions 1. even if the falling edge belongs to the sof of a recei ve message, this message will not be received and stored. if the cpu has tu rned off the clock to the can while the can was in sleep mode, later on the can sleep mode will not be rel eased and psmode1 and psmode0 bits will continue to be 01b unless th e clock for the can is provided again. in addition to this, the receive mes sage will not be received afterwards. 2. if the falling edge is detected on the can reception pin (crxdn) while the can clock is supplied, the psmode0 bit must be cleared by software (for details, refer to the processing in figure 19-53). after releasing the sleep mode, the can module return s to the operation mode from which the can sleep mode was requested and the psmode1 and psmode0 bits are reset to 00b. if the can sleep mode is released by a change in the can bus stat e, the cnints.cints5 bit is set to 1, regardless of the cnie.cie bit. after the can module is released from the can slee p mode, it participates in the can bus again by automatically detecting 11 consecutive recessive-level bi ts on the can bus. after releasing the sleep mode and before accessing the message buffer by application again, confirm that cngmctrl.mbon bit = 1. when a request for transition to the initialization mode is made while t he can module is in the can sleep mode, that request is ignored; the cpu has to be re leased from sleep mode by software first before entering the initialization mode. caution when the can sl eep mode is released by an event of the can bus, a wakeup interrupt occurs even if the event of the can bus occurs immediatel y after the mode has been changed to the sleep mode. note that the interrupt can occur at any time. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 879 19.11.2 can stop mode the can stop mode can be used to set the can controller to standby mode to reduce power consumption. the can module can enter the can stop mode only from the ca n sleep mode. release of the can stop mode puts the can module in the can sleep mode. the can stop mode can only be released (shifting to can sleep mode) by writing 01b to the cnctrl.psmode1 and cnctrl.psmode0 bits and not by a change in the ca n bus state. no message is transmitted even when transmission requests are issued or pending. remark n = 0, 1 (1) entering can stop mode a can stop mode transition request is issued by writing 11b to the psmode1 and psmode0 bits. a can stop mode request is only acknowledged when the ca n module is in the can sleep mode. in all other modes, the request is ignored. caution to set the can module to the can stop m ode, the module must be in the can sleep mode. to confirm that the module is in the sleep mode, check that the psmode1 and psmode0 bits = 01b, and then request the can stop m ode. if a bus change occurs at the can reception pin (crxdn) while this process is being performed, the can sleep mode is automatically released. in th is case, the can stop mode tr ansition request cannot be acknowledged (when the can clock is supplied, however , the psmode0 bit must be cleared by software after a bus change occurs at the can reception pin (crxdn)). (2) status in can stop mode the can module is in one of the following states after it enters the can stop mode. ? the internal operating clock is stopped a nd the power consumption is minimized. ? to wake up the can module from the cpu, data c an be written to the psmode1 and psmode0 bits, but nothing can be written to other cann module registers or bits. ? the cann module registers can be read, exc ept for the cnlipt, cnrg pt, cnlopt, and cntgpt registers. ? the cann message buffer register s cannot be written or read. ? the cngmctrl.mbon bit is cleared to 0. ? an initialization mode transition reques t is not acknowledged and is ignored. (3) releasing can stop mode the can stop mode can only be rele ased by writing 01b to the psmode1 and psmode0 bits. after releasing the can stop mode, the can module enters the can sleep mode. when the initialization mode is reques ted while the can module is in t he can stop mode, that request is ignored; the cpu has to release t he stop mode and subsequently the ca n sleep mode before entering into initialization mode. it is impossible to enter another operation mode directly from the can stop mode without entering the can sleep mode, the request will be ignored.
chapter 19 can controller user?s manual u16603ej5v1ud 880 19.11.3 example of using power saving modes in some application systems, it may be necessary to plac e the cpu in a power saving mode to reduce the power consumption. by using the power saving mode specific to the can module and the power saving mode specific to the cpu in combination, the cpu can be woken up fr om the power saving status by the can bus. here is an example of using the power saving modes. first, put the can module in the can sleep mode (psmode1 , psmode0 bits = 01b). next, put the cpu in the power saving mode. if an edge transition from recessive to dominant is detected at the crx dn signal in this status, the cints5 bit in the can module is set to 1. if the cnctrl.cie5 bit is set to 1, a wakeup interrupt (intcnwup) is generated. the can module is automatically released from the can sleep mode (psmode1, psmode0 bits = 00b) and returns to normal operation mode (when the can clock is supplied, however, the psmode0 bit must be cleared by software after a bus change occurs at the can receptio n pin (crxdn)). the cpu, in response to intcnwup, can release its own power saving mode and return to normal operation mode. to further reduce the power consumpti on of the cpu, the internal clocks, in cluding that of the can module, may be tuned off. in this case, the operatin g clock supplied to the can module is tu rned off after the can module is put in the can sleep mode. then the cpu enters a power saving mode in which the clock supplied to the cpu is turned off. if an edge transition from recessive to dominant is detected at the crxdn signal in this status, the can module can set the cints5 bit to 1 and generate a wa keup interrupt (intcnwup) even if it is not supplied with a clock. the other functions, however, do not operate because the clock supply to the can module is shut off, and the module remains in the can sleep mode. the cpu, in response to intc nwup, releases its power saving mode, resumes supply of the internal clocks, including the clock to the can module, after oscillation stabilization time has elapsed, and starts instruction execution. the can module is immediately released from the can sleep mode when the clock supply is resumed, and returns to normal operation mode (psmode1, psmode0 bits = 00b). remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 881 19.12 interrupt function the can module provides 6 different interrupt sources. the occurrence of these interrupt source s is stored in interrupt status regist ers. four separate interrupt request signals are generated from the six interrupt sources. when an interrupt request signal that corresponds to two or more interrupt sources is generated, the interrupt sources can be identified by us ing an interrupt status register. after an interrupt source has occurred, the corresponding inte rrupt status bit must be cleared to 0 by software. table 19-20. list of can module interrupt sources interrupt status bit interrupt enable bit no. name register name register interrupt request signal interrupt source description 1 cints0 note 1 cnints cie0 note 1 cnie intcntrx message frame successfu lly transmitted from message buffer m 2 cints1 note 1 cnints cie1 note 1 cnie intcnrec valid message frame reception in message buffer m 3 cints2 cnints cie2 cnie can module error state interrupt note 2 4 cints3 cnints cie3 cnie can module protocol error interrupt note 3 5 cints4 cnints cie4 cnie intcnerr can module arbitration loss interrupt 6 cints5 cnints cie5 cnie intcnwup can module wakeup interrupt from can sleep mode note 4 notes 1. the cnmctrl.ie bit (message buffer interrupt enable bit) of the corresponding message buffer has to be set to 1 for that message buffer to participate in the interrupt generation process. 2. this interrupt is generated when the transmission/rec eption error counter is at the warning level, or in the error passive or bus-off state. 3. this interrupt is generated when a stuff error, form error, ack error, bit e rror, or crc error occurs. 4. this interrupt is generated when the can module is woken up from the can sleep mode because a falling edge is detected at the can reception pin (c an bus transition from recessive to dominant). remark n = 0, 1 m = 00 to 31
chapter 19 can controller user?s manual u16603ej5v1ud 882 19.13 diagnosis functions and special operational modes the can module provides a receive-only mode, single- shot mode, and self-test mode to support can bus diagnosis functions or the operation of special can communication methods. 19.13.1 receive-only mode the receive-only mode is used to monitor receive mess ages without causing any interference on the can bus and can be used for can bus analysis nodes. for example, this mode can be used for automatic baud- rate detection. the baud rate in the can module is changed until ?valid reception? is dete cted, so that the baud rates in the module match (?valid reception? means a message frame has been received in the can protocol la yer without occurrence of an error and with an appropriate ack between nodes connected to the can bus). a valid rec eption does not require mess age frames to be stored in a receive message buffer (data frames) or transmit message bu ffer (remote frames). the event of valid reception is indicated by setting the cnctrl.valid bit (1). figure 19-33. can module terminal co nnection in receive-only mode can macro tx rx crxdn ctxdn fixed to the recessive level in the receive-only mode, no message frames can be transm itted from the can module to the can bus. transmit requests issued for message buffers defined as transmit message buffers are held pending. in the receive-only mode, the can transmission pin (ctxdn) in the can module is fixed to the recessive level. therefore, no active error flag can be transmitted from t he can module to the can bus even when a can bus error is detected while receiving a message frame. since no transmission can be issued from the can module, the transmission error counter the cnerc.tec7 to cnerc.tec0 bits are never updated. therefore, a can module in the receive-only mode does no t enter the bus-off state. furthermore, ack is not returned to the can bus in th is mode upon the valid reception of a message frame. internally, the local node recognizes that it has transmitted ack. an overload frame cannot be transmitted to the can bus.
chapter 19 can controller user?s manual u16603ej5v1ud 883 caution if only two can nodes are conn ected to the can bus and one of them is operating in the receive- only mode, there is no ack on the can bus. due to the missing ack, the tran smitting node will transmit an active error flag, a nd repeat transmitting a message fr ame. the transmitting node becomes error passive after tran smitting the message frame 16 ti mes (assuming that the error counter was 0 in the beginning and no other erro rs have occurred). wh en the message frame is transmitted for the 17th time, the transmitting node generates a pa ssive error flag. the receiving node in the receive-only mode det ects the first valid m essage frame at this point, and the valid bit is set to 1 for the first time. remark n = 0, 1 19.13.2 single-shot mode in the single-shot mode, automatic re-t ransmission as defined in the can protoc ol is switched off. (according to the can protocol, a message frame transmission that has been aborted by either arbitration loss or error occurrence has to be repeated without control by softwar e.) all other behavior of single shot mode is identical to normal operation mode. features of single shot mode can not be used in combination with normal mode with abt. the single-shot mode disables the re-transmission of an aborted message frame transmission according to the setting of the cnctrl.al bit. when the al bit is cleared to 0, re-transmission upon arbitration loss and upon error occurrence is disabled. if the al bit is set to 1, re-trans mission upon error occurrence is disabled, but re-transmission upon arbitration loss is enabled. as a consequence, the cnmctrlm.trq bi t in a message buffer defined as a transmit message buffer is cleared to 0 by the following events. ? successful transmission of the message frame ? arbitration loss while sending the message frame (al bit = 0) ? error occurrence while sending the message frame the events arbitration loss and error occurrence can be distinguished by checking the cnints.cints4 and cnints.cints3 bits, and the type of the error can be identi fied by reading the cnlec.lec2 to cnlec.lec0 bits of the register. upon successful transmission of the message frame, the tr ansmit completion interrupt the cints0 bit of the cnints register is set to 1. if the cnie.cie0 bit is se t to 1 at this time, an interrupt request signal is output. the single-shot mode can be used when emulating time-t riggered communication methods (e.g., ttcan level 1). caution the al bit is only valid in single-shot mode. it does not affect the op eration of re-transmission upon arbitration loss in other operation modes. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 884 19.13.3 self-test mode in the self-test mode, message frame transmission and message frame reception can be tested without connecting the can node to the can bus or without affecting the can bus. in the self-test mode, the can module is completely disconnected from the ca n bus, but transmission and reception are internally looped back. the can transmi ssion pin (ctxdn) is fixed to the recessive level. if the falling edge on the can reception pin (crxdn) is det ected after the can module has entered the can sleep mode from the self-test mode, however, the module is released from the can sl eep mode in the same manner as the other operation modes (when the can clock is supplied, however, the psmode0 bit must be cleared by software after a falling edge is detected at the can reception pin (crxdn)). to keep the module in the can sleep mode, use the can reception pin (crxdn) as a port pin. remark n = 0, 1 figure 19-34. can module terminal connection in self-test mode can macro tx rx crxdn ctxdn fixed to the recessive level
chapter 19 can controller user?s manual u16603ej5v1ud 885 19.13.4 transmission/reception ope ration in each operation mode table 19-21 shows the transmission/recept ion operation in each operation mode. table 19-21. overview of transmission/r eception operation in each operation mode operation mode data frame/ remote frame transmission ack transmission error frame/ overload frame transmission retransmission automatic block transmission (abt) setting of valid bit storing data in message buffer initialization mode ? ? ? ? ? ? ? normal operation mode ? normal operation mode with abt receive-only mode ? ? ? ? ? single-shot mode ? note 1 ? self test mode note 2 note 2 note 2 note 2 ? note 2 note 2 notes 1. if arbitration is lost, retransmission can be selected by the cnctrl.al bit. 2. each signal is not output to the external circ uit but is internally generated by the can module.
chapter 19 can controller user?s manual u16603ej5v1ud 886 19.14 time stamp function can is an asynchronous, serial protocol. all nodes connect ed to the can bus have a local, autonomous clock. as a consequence, the clocks of the nodes have no relation (i.e., the clocks are asynchronous and may even have different frequencies). in some applications, however, a common time base over the network (= global time base) is needed. in order to build up a global time base, a time stam p function is used. the essential mechan ism of a time stamp function is the capture of timer values triggered by signals on the can bus. 19.14.1 time stamp function the can controller supports the capturing of timer values triggered by a specific frame. an on-chip 16-bit capture timer unit in a microcontroller system is us ed in addition to the can c ontroller. the 16-bit capture timer unit captures the timer value according to a trigger signal (tsout) for ca pturing that is out put when a data frame is received from the can controller. the cpu can retrie ve the time of occurrence of the capt ure event, i.e., the time stamp of the message received from the can bus, by reading the captur ed value. the tsout signal can be selected from the following two event sources and is specified by the cnts.tssel bit. ? sof event (start of frame) (tssel bit = 0) ? eof event (last bit of end of frame) (tssel bit = 1) the tsout signal is enabled by setting the cnts.tsen bit to 1. figure 19-35. timing diagram of capture signal tsout t tsout sof sof sof sof the tsout signal toggles its level upon occurrence of the selected event during data frame reception (in figure 19-34, the sof is used as the trigger event source). to capture a timer value by using the tsout signal, the capture timer unit must detect the capture signal at both the rising edge and falling edge. this time stamp function is controlled by the cnts.tsl ock bit. when the tslock bit is cleared to 0, the tsout signal toggles upon occurrence of the selected event. if the tslock bit is set to 1, the tsout signal toggles upon occurrence of the selected event, but the toggle is stopped as the tsen bit is automatically cleared to 0 when a data frame starts to be received and stored in message buffer 0. this suppresses the subsequent toggle occurrence by the tsout signal, so that the time stamp value toggled last (= captured last) can be saved as the time stamp value of the time at which the data frame was received in message buffer 0.
chapter 19 can controller user?s manual u16603ej5v1ud 887 caution the time stamp function using the tslock bit stops toggle of the tsout signal by receiving a data frame in message buffer 0. therefore, me ssage buffer 0 must be set as a receive message buffer. since a receive messag e buffer cannot receive a remote frame, toggle of the tsout signal cannot be stopped by recep tion of a remote frame. togg le of the tsout signal does not stop when a data frame is received in a message buffer other than message buffer 0. for these reasons, a data frame ca nnot be received in message buffer 0 when the can module is in the normal operation mode with abt, becau se message buffer 0 must be set as a transmit message buffer. in this oper ation mode, therefore, the function to stop toggle of the tsout signal by the tslock bit cannot be used. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 888 19.15 baud rate settings 19.15.1 bit rate setting conditions make sure that the settings are within the range of limit values for ensuring co rrect operation of the can controller, as follows. (a) 5tq spt (sampling point) 17tq spt = tseg1 + 1tq (b) 8tq dbt (data bit time) 25tq dbt = tseg1 + tseg2 + 1tq = tseg2 + spt (c) 1tq sjw (synchronization jump width) 4tq sjw dbt ? spt (d) 4tq tseg1 16tq [3 setting value of tseg1[3:0] 15] (e) 1tq tseg2 8tq [0 setting value of tseg2[2:0] 7] remark tq = 1/f tq (f tq : can protocol layer basic system clock) tseg1[3:0] (cnbtr.tseg13 to cn btr.tseg10 bits) (n = 0, 1) tseg2[2:0] (cnbtr.tseg22 to cn btr.tseg20 bits) (n = 0, 1) table 19-22 shows the combinations of bi t rates that satisfy the above conditions.
chapter 19 can controller user?s manual u16603ej5v1ud 889 table 19-22. settable bit rate combinations (1/3) valid bit rate setting cnbtr register setting value dbt length sync segment prop segment phase segment1 phase segment2 tseg13 to tseg10 tseg22 to tseg20 sampling point (unit %) 25 1 8 8 8 1111 111 68.0 24 1 7 8 8 1110 111 66.7 24 1 9 7 7 1111 110 70.8 23 1 6 8 8 1101 111 65.2 23 1 8 7 7 1110 110 69.6 23 1 10 6 6 1111 101 73.9 22 1 5 8 8 1100 111 63.6 22 1 7 7 7 1101 110 68.2 22 1 9 6 6 1110 101 72.7 22 1 11 5 5 1111 100 77.3 21 1 4 8 8 1011 111 61.9 21 1 6 7 7 1100 110 66.7 21 1 8 6 6 1101 101 71.4 21 1 10 5 5 1110 100 76.2 21 1 12 4 4 1111 011 81.0 20 1 3 8 8 1010 111 60.0 20 1 5 7 7 1011 110 65.0 20 1 7 6 6 1100 101 70.0 20 1 9 5 5 1101 100 75.0 20 1 11 4 4 1110 011 80.0 20 1 13 3 3 1111 010 85.0 19 1 2 8 8 1001 111 57.9 19 1 4 7 7 1010 110 63.2 19 1 6 6 6 1011 101 68.4 19 1 8 5 5 1100 100 73.7 19 1 10 4 4 1101 011 78.9 19 1 12 3 3 1110 010 84.2 19 1 14 2 2 1111 001 89.5 18 1 1 8 8 1000 111 55.6 18 1 3 7 7 1001 110 61.1 18 1 5 6 6 1010 101 66.7 18 1 7 5 5 1011 100 72.2 18 1 9 4 4 1100 011 77.8 18 1 11 3 3 1101 010 83.3 18 1 13 2 2 1110 001 88.9 18 1 15 1 1 1111 000 94.4 remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 890 table 19-22. settable bit rate combinations (2/3) valid bit rate setting cnbtr register setting value dbt length sync segment prop segment phase segment1 phase segment2 tseg13 to tseg10 tseg22 to tseg20 sampling point (unit %) 17 1 2 7 7 1000 110 58.8 17 1 4 6 6 1001 101 64.7 17 1 6 5 5 1010 100 70.6 17 1 8 4 4 1011 011 76.5 17 1 10 3 3 1100 010 82.4 17 1 12 2 2 1101 001 88.2 17 1 14 1 1 1110 000 94.1 16 1 1 7 7 0111 110 56.3 16 1 3 6 6 1000 101 62.5 16 1 5 5 5 1001 100 68.8 16 1 7 4 4 1010 011 75.0 16 1 9 3 3 1011 010 81.3 16 1 11 2 2 1100 001 87.5 16 1 13 1 1 1101 000 93.8 15 1 2 6 6 0111 101 60.0 15 1 4 5 5 1000 100 66.7 15 1 6 4 4 1001 011 73.3 15 1 8 3 3 1010 010 80.0 15 1 10 2 2 1011 001 86.7 15 1 12 1 1 1100 000 93.3 14 1 1 6 6 0110 101 57.1 14 1 3 5 5 0111 100 64.3 14 1 5 4 4 1000 011 71.4 14 1 7 3 3 1001 010 78.6 14 1 9 2 2 1010 001 85.7 14 1 11 1 1 1011 000 92.9 13 1 2 5 5 0110 100 61.5 13 1 4 4 4 0111 011 69.2 13 1 6 3 3 1000 010 76.9 13 1 8 2 2 1001 001 84.6 13 1 10 1 1 1010 000 92.3 12 1 1 5 5 0101 100 58.3 12 1 3 4 4 0110 011 66.7 12 1 5 3 3 0111 010 75.0 12 1 7 2 2 1000 001 83.3 12 1 9 1 1 1001 000 91.7 remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 891 table 19-22. settable bit rate combinations (3/3) valid bit rate setting cnbtr register setting value dbt length sync segment prop segment phase segment1 phase segment2 tseg13 to tseg10 tseg22 to tseg20 sampling point (unit %) 11 1 2 4 4 0101 011 63.6 11 1 4 3 3 0110 010 72.7 11 1 6 2 2 0111 001 81.8 11 1 8 1 1 1000 000 90.9 10 1 1 4 4 0100 011 60.0 10 1 3 3 3 0101 010 70.0 10 1 5 2 2 0110 001 80.0 10 1 7 1 1 0111 000 90.0 9 1 2 3 3 0100 010 66.7 9 1 4 2 2 0101 001 77.8 9 1 6 1 1 0110 000 88.9 8 1 1 3 3 0011 010 62.5 8 1 3 2 2 0100 001 75.0 8 1 5 1 1 0101 000 87.5 7 note 1 2 2 2 0011 001 71.4 7 note 1 4 1 1 0100 000 85.7 6 note 1 1 2 2 0010 001 66.7 6 note 1 3 1 1 0011 000 83.3 5 note 1 2 1 1 0010 000 80.0 4 note 1 1 1 1 0001 000 75.0 note setting with a dbt value of 7 or less is valid only wh en the value of the cnbrp r egister is other than 00h. caution the values in table 19-22 do not guarantee th e operation of the network system. thoroughly check the effect on the network system, taking into consideration oscillation errors and delays of the can bus and can transceiver. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 892 19.15.2 representative examples of baud rate settings tables 19-23 and 19-24 show representative examples of baud rate settings. table 19-23. representative e xamples of baud rate settings (f canmod = 8 mhz) (1/2) valid bit rate setting (unit: tq) cnbtr register setting value set baud rate value (unit: kbps) division ratio of cnbrp register cnbrp register set value length of dbt sync segment prop segment phase segment1 phase segment2 tseg13 to tseg10 tseg22 to tseg20 sampling point (unit: %) 1000 1 00000000 8 1 1 3 3 0011 010 62.5 1000 1 00000000 8 1 3 2 2 0100 001 75.0 1000 1 00000000 8 1 5 1 1 0101 000 87.5 500 1 00000000 16 1 1 7 7 0111 110 56.3 500 1 00000000 16 1 3 6 6 1000 101 62.5 500 1 00000000 16 1 5 5 5 1001 100 68.8 500 1 00000000 16 1 7 4 4 1010 011 75.0 500 1 00000000 16 1 9 3 3 1011 010 81.3 500 1 00000000 16 1 11 2 2 1100 001 87.5 500 1 00000000 16 1 13 1 1 1101 000 93.8 500 2 00000001 8 1 1 3 3 0011 010 62.5 500 2 00000001 8 1 3 2 2 0100 001 75.0 500 2 00000001 8 1 5 1 1 0101 000 87.5 250 2 00000001 16 1 1 7 7 0111 110 56.3 250 2 00000001 16 1 3 6 6 1000 101 62.5 250 2 00000001 16 1 5 5 5 1001 100 68.8 250 2 00000001 16 1 7 4 4 1010 011 75.0 250 2 00000001 16 1 9 3 3 1011 010 81.3 250 2 00000001 16 1 11 2 2 1100 001 87.5 250 2 00000001 16 1 13 1 1 1101 000 93.8 250 4 00000011 8 1 3 2 2 0100 001 75.0 250 4 00000011 8 1 5 1 1 0101 000 87.5 125 4 00000011 16 1 1 7 7 0111 110 56.3 125 4 00000011 16 1 3 6 6 1000 101 62.5 125 4 00000011 16 1 5 5 5 1001 100 68.8 125 4 00000011 16 1 7 4 4 1010 011 75.0 125 4 00000011 16 1 9 3 3 1011 010 81.3 125 4 00000011 16 1 11 2 2 1100 001 87.5 125 4 00000011 16 1 13 1 1 1101 000 93.8 125 8 00000111 8 1 3 2 2 0100 001 75.0 125 8 00000111 8 1 5 1 1 0101 000 87.5 caution the values in table 19-23 do not guarantee th e operation of the network system. thoroughly check the effect on the network system, taking into consideration oscillation errors and delays of the can bus and can transceiver. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 893 table 19-23. representative e xamples of baud rate settings (f canmod = 8 mhz) (2/2) valid bit rate setting (unit: tq) cnbtr register setting value set baud rate value (unit: kbps) division ratio of cnbrp register cnbrp register set value length of dbt sync segment prop segment phase segment1 phase segment2 tseg13 to tseg10 tseg22 to tseg20 sampling point (unit: %) 100 4 00000011 20 1 7 6 6 1100 101 70.0 100 4 00000011 20 1 9 5 5 1101 100 75.0 100 5 00000100 16 1 7 4 4 1010 011 75.0 100 5 00000100 16 1 9 3 3 1011 010 81.3 100 8 00000111 10 1 3 3 3 0101 010 70.0 100 8 00000111 10 1 5 2 2 0110 001 80.0 100 10 00001001 8 1 3 2 2 0100 001 75.0 100 10 00001001 8 1 5 1 1 0101 000 87.5 83.3 4 00000011 24 1 7 8 8 1110 111 66.7 83.3 4 00000011 24 1 9 7 7 1111 110 70.8 83.3 6 00000101 16 1 5 5 5 1001 100 68.8 83.3 6 00000101 16 1 7 4 4 1010 011 75.0 83.3 6 00000101 16 1 9 3 3 1011 010 81.3 83.3 6 00000101 16 1 11 2 2 1100 001 87.5 83.3 8 00000111 12 1 5 3 3 0111 010 75.0 83.3 8 00000111 12 1 7 2 2 1000 001 83.3 83.3 12 00001011 8 1 3 2 2 0100 001 75.0 83.3 12 00001011 8 1 5 1 1 0101 000 87.5 33.3 10 00001001 24 1 7 8 8 1110 111 66.7 33.3 10 00001001 24 1 9 7 7 1111 110 70.8 33.3 12 00001011 20 1 7 6 6 1100 101 70.0 33.3 12 00001011 20 1 9 5 5 1101 100 75.0 33.3 15 00001110 16 1 7 4 4 1010 011 75.0 33.3 15 00001110 16 1 9 3 3 1011 010 81.3 33.3 16 00001111 15 1 6 4 4 1001 011 73.3 33.3 16 00001111 15 1 8 3 3 1010 010 80.0 33.3 20 00010011 12 1 5 3 3 0111 010 75.0 33.3 20 00010011 12 1 7 2 2 1000 001 83.3 33.3 24 00010111 10 1 3 3 3 0101 010 70.0 33.3 24 00010111 10 1 5 2 2 0110 001 80.0 33.3 30 00011101 8 1 3 2 2 0100 001 75.0 33.3 30 00011101 8 1 5 1 1 0101 000 87.5 caution the values in table 19-23 do not guarantee th e operation of the network system. thoroughly check the effect on the network system, taking into consideration oscillation errors and delays of the can bus and can transceiver. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 894 table 19-24. representative e xamples of baud rate settings (f canmod = 16 mhz) (1/2) valid bit rate setting (unit: tq) cnbtr register setting value set baud rate value (unit: kbps) division ratio of cnbrp register cnbrp register set value length of dbt sync segment prop segment phase segment1 phase segment2 tseg13 to tseg10 tseg22 to tseg20 sampling point (unit: %) 1000 1 00000000 16 1 1 7 7 0111 110 56.3 1000 1 00000000 16 1 3 6 6 1000 101 62.5 1000 1 00000000 16 1 5 5 5 1001 100 68.8 1000 1 00000000 16 1 7 4 4 1010 011 75.0 1000 1 00000000 16 1 9 3 3 1011 010 81.3 1000 1 00000000 16 1 11 2 2 1100 001 87.5 1000 1 00000000 16 1 13 1 1 1101 000 93.8 1000 2 00000001 8 1 3 2 2 0100 001 75.0 1000 2 00000001 8 1 5 1 1 0101 000 87.5 500 2 00000001 16 1 1 7 7 0111 110 56.3 500 2 00000001 16 1 3 6 6 1000 101 62.5 500 2 00000001 16 1 5 5 5 1001 100 68.8 500 2 00000001 16 1 7 4 4 1010 011 75.0 500 2 00000001 16 1 9 3 3 1011 010 81.3 500 2 00000001 16 1 11 2 2 1100 001 87.5 500 2 00000001 16 1 13 1 1 1101 000 93.8 500 4 00000011 8 1 3 2 2 0100 001 75.0 500 4 00000011 8 1 5 1 1 0101 000 87.5 250 4 00000011 16 1 3 6 6 1000 101 62.5 250 4 00000011 16 1 5 5 5 1001 100 68.8 250 4 00000011 16 1 7 4 4 1010 011 75.0 250 4 00000011 16 1 9 3 3 1011 010 81.3 250 4 00000011 16 1 11 2 2 1100 001 87.5 250 8 00000111 8 1 3 2 2 0100 001 75.0 250 8 00000111 8 1 5 1 1 0101 000 87.5 125 8 00000111 16 1 3 6 6 1000 101 62.5 125 8 00000111 16 1 7 4 4 1010 011 75.0 125 8 00000111 16 1 9 3 3 1011 010 81.3 125 8 00000111 16 1 11 2 2 1100 001 87.5 125 16 00001111 8 1 3 2 2 0100 001 75.0 125 16 00001111 8 1 5 1 1 0101 000 87.5 caution the values in table 19-24 do not guarantee th e operation of the network system. thoroughly check the effect on the network system, taking into consideration oscillation errors and delays of the can bus and can transceiver. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 895 table 19-24. representative e xamples of baud rate settings (f canmod = 16 mhz) (2/2) valid bit rate setting (unit: tq) cnbtr register setting value set baud rate value (unit: kbps) division ratio of cnbrp register cnbrp register set value length of dbt sync segment prop segment phase segment1 phase segment2 tseg13 to tseg10 tseg22 to tseg20 sampling point (unit: %) 100 8 00000111 20 1 9 5 5 1101 100 75.0 100 8 00000111 20 1 11 4 4 1110 011 80.0 100 10 00001001 16 1 7 4 4 1010 011 75.0 100 10 00001001 16 1 9 3 3 1011 010 81.3 100 16 00001111 10 1 3 3 3 0101 010 70.0 100 16 00001111 10 1 5 2 2 0110 001 80.0 100 20 00010011 8 1 3 2 2 0100 001 75.0 83.3 8 00000111 24 1 7 8 8 1110 111 66.7 83.3 8 00000111 24 1 9 7 7 1111 110 70.8 83.3 12 00001011 16 1 7 4 4 1010 011 75.0 83.3 12 00001011 16 1 9 3 3 1011 010 81.3 83.3 12 00001011 16 1 11 2 2 1100 001 87.5 83.3 16 00001111 12 1 5 3 3 0111 010 75.0 83.3 16 00001111 12 1 7 2 2 1000 001 83.3 83.3 24 00010111 8 1 3 2 2 0100 001 75.0 83.3 24 00010111 8 1 5 1 1 0101 000 87.5 33.3 30 00011101 24 1 7 8 8 1110 111 66.7 33.3 30 00011101 24 1 9 7 7 1111 110 70.8 33.3 24 00010111 20 1 9 5 5 1101 100 75.0 33.3 24 00010111 20 1 11 4 4 1110 011 80.0 33.3 30 00011101 16 1 7 4 4 1010 011 75.0 33.3 30 00011101 16 1 9 3 3 1011 010 81.3 33.3 32 00011111 15 1 8 3 3 1010 010 80.0 33.3 32 00011111 15 1 10 2 2 1011 001 86.7 33.3 37 00100100 13 1 6 3 3 1000 010 76.9 33.3 37 00100100 13 1 8 2 2 1001 001 84.6 33.3 40 00100111 12 1 5 3 3 0111 010 75.0 33.3 40 00100111 12 1 7 2 2 1000 001 83.3 33.3 48 00101111 10 1 3 3 3 0101 010 70.0 33.3 48 00101111 10 1 5 2 2 0110 001 80.0 33.3 60 00111011 8 1 3 2 2 0100 001 75.0 33.3 60 00111011 8 1 5 1 1 0101 000 87.5 caution the values in table 19-24 do not guarantee th e operation of the network system. thoroughly check the effect on the network system, taking into consideration oscillation errors and delays of the can bus and can transceiver. remark n = 0, 1
chapter 19 can controller user?s manual u16603ej5v1ud 896 19.16 operation of can controller the processing procedure shown below is recommended to operate the can controller. develop your program by referring to this recommended processing procedure. remark n = 0, 1 m = 00 to 31 figure 19-36. initialization start set cngmcs register. set cnbrp register, cnbtr register. set cnie register. set cnmask register. initialize message buffers. set cnctrl register. (set opmode bit.) end set cngmctrl register. (set gom bit = 1) remark opmode: normal operation mode, normal operation mode with abt, receive-only mode, single- shot mode, self-test mode
chapter 19 can controller user?s manual u16603ej5v1ud 897 figure 19-37. re-initialization start set cnbrp register, cnbtr register. set cnie register. set cnmask register. set cnctrl register. (set opmode bit.) end clear opmode. init mode? no yes no cnerc and cninfo register clear? initialize message buffers. yes set ccerc bit. set ccerc bit = 1 caution after setting the can module to the initializ ation mode, avoid setting the module to another operation mode immediately after. if it is necessary to immediat ely set the module to another operation mode, be sure to access registers other than the cnctrl and cngmctrl registers (e.g., set a message buffer). remark opmode: normal operation mode, normal operation mode with abt, receive-only mode, single- shot mode, self-test mode
chapter 19 can controller user?s manual u16603ej5v1ud 898 figure 19-38. message buffer initialization start set cnmconfm register. set cnmidhm register, cnmidlm register. set cnmdlcm register. clear cnmdatam register. set cnmctrlm register. end transmit message buffer? yes no clear rdy bit. set rdy bit = 0 clear rdy bit = 1 rdy bit = 1? rdy bit = 0? no yes yes set rdy bit. set rdy bit = 1 clear rdy bit = 0 no cautions 1. before a message buffer is in itialized, the rdy bit must be cleared. 2. make the following settings for message buffers not u sed by the application. ? clear the cnmctrlm.rdy, cnmctrlm .trq, and cnmctrlm.dn bits to 0. ? clear the cnmconfm.ma0 bit to 0.
chapter 19 can controller user?s manual u16603ej5v1ud 899 figure 19-39 shows the processing for a receive mess age buffer (cnmconfm.mt2 to cnmconfm.mt0 bits = 001b to 101b). figure 19-39. message buffer redefinition no ye s note no ye s ye s no start set message buffers. end rdy = 1? clear rdy bit. set rdy bit = 0 clear rdy bit = 1 rdy = 0? rstat = 0 or valid = 1? note 1 clear valid bit. set rdy bit. set rdy bit = 1 clear rdy bit = 0 wait for a period of 4 can data bits. note 2 notes 1. if redefinition is performed during a message recept ion, confirm that a message is being received because the rdy bit must be set after a message is completely received. 2. this 4-bit period may redefine the message bu ffer while a message is received and stored.
chapter 19 can controller user?s manual u16603ej5v1ud 900 figure 19-40 shows the processing for a transmit me ssage buffer during transmission (cnmconfm.mt2 to cnmconfm.mt0 bits = 000b). figure 19-40. message buffer rede finition during transmission no ye s remote frame data frame = 0 = 1 ye s no start end rdy bit = 0? data frame or remote frame? set rdy bit. set rdy bit = 1 clear rdy bit = 0 set cnmdataxm, cnmdlcm registers. clear rtr bit of cnmconfm register. set cnmidlm and cnmidhm registers. set cnmdlcm register. set rtr bit of cnmconfm register. set cnmidlm and cnmidhm registers. transmit abort process clear rdy bit. set rdy bit = 0 clear rdy bit = 1 transmit? set trq bit. set trq bit = 1 clear trq bit = 0 wait for a period of 1 can data bit.
chapter 19 can controller user?s manual u16603ej5v1ud 901 figure 19-41 shows the processing for a transmit message buffer (cnmconfm.mt2 to cnmconfm.mt0 bits = 000b). figure 19-41. message transmit processing start set trq bit. set trq bit = 1 clear trq bit = 0 end trq bit = 0? yes no clear rdy bit. set rdy bit = 0 clear rdy bit = 1 set rdy bit. set rdy bit = 1 clear rdy bit = 0 rdy bit = 0? yes no data frame or remote frame? remote frame data frame set rtr bit of cnmdlcm register and cnmconfm register. set cnmidlm and cnmidhm registers. set cnmdataxm, cnmdlcm registers. clear rtr bit of cnmconfm register. set cnmidlm and cnmidhm registers. cautions 1. the rdy bit should be set before the trq bit is set. 2. the rdy bit and trq bit should not be set at the same time.
chapter 19 can controller user?s manual u16603ej5v1ud 902 figure 19-42 shows the processing for a transmit message buffer (cnmconfm.mt2 to cnmconfm.mt0 bits = 000b). figure 19-42. abt message transmit processing end no ye s = 0 ye s no ye s no ye s no start end abttrg bit = 0? clear rdy bit set rdy bit = 0 clear rdy bit = 1 rdy bit = 0? set rdy bit. set rdy bit = 1 clear rdy bit = 0 set abttrg bit. set abttrg bit = 1 clear abttrg bit = 0 set all abt transmit messages? tstat bit = 0? set cnmdataxm register. set cnmdlcm register. clear rtr bit of cnmconfm register. set cnmidlm and cnmidhm registers. caution the abttrg bit should be set to 1 after the tstat bit is clea red to 0. the checking of the tstat bit and the setting for the abttrg bit to 1 must be continuous. remark this processing (message transmit processing wit h abs) can only be applied to message buffers 0 to 7. for message buffers other than the abt message buffers, see figure 19-41 .
chapter 19 can controller user?s manual u16603ej5v1ud 903 figure 19-43. transmission via in terrupt (using cnlopt register) start end transmit completion interrupt servicing read cnlopt register. clear rdy bit. set rdy bit = 0 clear rdy bit = 1 rdy bit = 0? no yes set rdy bit. set rdy bit = 1 clear rdy bit = 0 set trq bit. set trq bit = 1 clear trq bit = 0 data frame or remote frame? remote frame data frame set cnmdlcm register. set rtr bit of cnmconfm register. set cnmidlm and cnmidhm registers. set cnmdataxm, cnmdlcm registers. clear rtr bit of cnmconfm register. set cnmidlm and cnmidhm registers. cautions 1. the trq bit should be set after the rdy bit is set. 2. the rdy bit and trq bit should not be set at the same time. remark check the mbon bit at the start and end of the in terrupt routine to see if the message buffer and transmit history register can be accessed, because a can sleep mode transition request which has been held pending may be under execution. if t he mbon bit is cleared (0), stop the processing under execution. re-execute the processing afte r the mbon bit is set (1) again. it is therefore recommended to cancel the can sleep mode trans ition request before executing transmission interrupt servicing.
chapter 19 can controller user?s manual u16603ej5v1ud 904 figure 19-44. transmission via in terrupt (using cntgpt register) start end clear rdy bit. set rdy bit = 0 clear rdy bit = 1 tovf bit = 1? clear tovf bit. clear tovf bit = 1 thpm bit = 1? yes no yes no transmit completion interrupt servicing set rdy bit. set rdy bit = 1 clear rdy bit = 0 set trq bit. set rdy bit = 1 clear rdy bit = 0 read cntgpt register. rdy bit = 0? yes no data frame or remote frame? remote frame data frame set cnmdlcm register. set rtr bit of cnmconfm register. set cnmidlm and cnmidhm registers. set cnmdataxm, cnmdlcm registers. clear rtr bit of cnmconfm register. set cnmidlm and cnmidhm registers. cautions 1. the trq bit should be set after the rdy bit is set. 2. the rdy bit and trq bit should not be set at the same time. remarks 1. check the mbon bit at the start and end of the in terrupt routine to see if the message buffer and transmit history register can be accessed, bec ause a can sleep mode transition request which has been held pending may be under execution. if the mbon bit is cleared (0), stop the processing under execution. re-execute the proce ssing after the mbon bit is set (1) again. it is therefore recommended to cancel the can sl eep mode transition request before executing transmission interrupt servicing. 2. if the tovf bit is set (1) again, the transmit hi story list contradicts. therefore, scan all the transmit message buffers that have completed transmission.
chapter 19 can controller user?s manual u16603ej5v1ud 905 figure 19-45. transmi ssion via software polling start end read cntgpt register. cints0 bit = 1? tovf bit = 1? clear tovf bit. clear tovf bit = 1 thpm bit = 1? yes no yes no yes no clear cints0 bit. clear cints0 bit = 1 clear rdy bit. set rdy bit = 0 clear rdy bit = 1 set rdy bit. set rdy bit = 1 clear rdy bit = 0 set trq bit. set trq bit = 1 clear trq bit = 0 rdy bit = 0? no yes data frame or remote frame? set cnmdlcm register. set rtr bit of cnmconfm register. set cnmidlm and cnmidhm registers. set cnmdataxm, cnmdlcm registers. clear rtr bit of cnmconfm register. set cnmidlm and cnmidhm registers. remote frame data frame cautions 1. the trq bit should be set after the rdy bit is set. 2. the rdy bit and trq bit should not be set at the same time. remarks 1. check the mbon bit at the start and end of the polling routine to see if the message buffer and transmit history register can be accessed, bec ause a can sleep mode transition request which has been held pending may be under execution. if the mbon bit is cleared (0), stop the processing under execution. re-execute the pr ocessing after the mbon bit is set (1) again. 2. if the tovf bit is set (1) again, the transmit hi story list contradicts. therefore, scan all the transmit message buffers that have completed transmission.
chapter 19 can controller user?s manual u16603ej5v1ud 906 figure 19-46. transmission abort processing (oth er than in normal operation mode with abt) start no yes end clear trq bit. set trq bit = 0 clear trq bit = 1 tstat bit = 0? no wait for a period of 11 can data bits note . yes read cnlopt register. message buffer to be aborted matches cnlopt register? transmission successful transmit abort processing successful. note during a period of a total of 11 bits, 3 bits of in terframe space and 8 bits of suspend transmission, the transmission request may have already been acknowle dged by the protocol layer. consequently, transmission may not be aborted but star ted even if the trq bit is cleared. cautions 1. execute transmissi on abort processing by clearing th e trq bit, not the rdy bit. 2. before making a sleep mode transition request, confirm th at there is no transmission request left using this processing. 3. the tstat bit can be period ically checked by a user app lication or can be checked after the transmit completion interrupt. 4. do not execute a new transmission request that includes other message buffers while transmission abort processing is in progress. 5. if data of the same message buffer are successively transmitted or if only one message buffer is used, judgments wh ether transmission has been successfully executed or failed may contradict. in such a case, make a judgm ent by using the histor y information of the cntgpt register.
chapter 19 can controller user?s manual u16603ej5v1ud 907 figure 19-47. transmission abort pro cessing except for abt transmission (normal operation mode with abt) no ye s no transmission successful transmit abort processing successful. ye s no = 0 ye s start read cnlopt register. end clear trq bit. set trq bit = 0 clear trq bit = 1 tstat bit = 0? message buffer to be aborted matches cnlopt register? wait for a period of 11 can data bits note . abttrg bit = 0? clear abttrg bit. set abttrg bit = 0 clear abttrg bit = 1 note during a period of a total of 11 bits, 3 bits of in terframe space and 8 bits of suspend transmission, the transmission request may have already been acknowledged by the protocol layer. consequently, transmission may not be aborted but star ted even if the trq bit is cleared. cautions 1. execute transmission request abort pr ocessing by clearing the trq bit, not the rdy bit. 2. before making a sleep mo de transition request, confirm th at there is no transmission request left using this processing. 3. the tstat bit can be periodically checked by a user application or can be checked after the transmit completion interrupt. 4. do not execute the new tran smission request including in th e other message buffers while transmission abort processing is in progress. 5. if data of the same message buffer are su ccessively transmitted or if only one message buffer is used, judgments whet her transmission has been su ccessfully executed or failed may contradict. in such a cas e, make a judgment by using th e history information of the cntgpt register.
chapter 19 can controller user?s manual u16603ej5v1ud 908 figure 19-48 (a) shows processing that does not skip resu ming the transmission of a message that was interrupted when the transmission of an abt message buffer was aborted. figure 19-48 (a). abt transmission abort pr ocessing (normal operation mode with abt) end abttrg bit = 0? yes no start no yes clear abttrg bit. set abttrg bit = 0 clear abttrg bit = 1 set abtclr bit. set abtclr bit = 1. clear trq bit of message buffer whose transmission was aborted. transmit abort transmission start pointer clear? tstat bit = 0? yes no cautions 1. do not set any tr ansmission requests while abt tran smission abort processing is in progress. 2. make a can sleep mode/can stop mode tr ansition request after the abttrg bit is cleared (after abt mode is stopped) following the procedure shown in figure 19-48 (a) or (b). when clearing a transmi ssion request in an area other than the abt ar ea, follow the procedure shown in figure 19-46.
chapter 19 can controller user?s manual u16603ej5v1ud 909 figure 19-48 (b) shows the processing that does not ski p resuming the transmission of a message that was interrupted when the transmission of an abt message buffer was aborted. figure 19-48 (b). abt transmission request abor t processing (normal operation mode with abt) end abttrg bit = 0? yes no start no yes clear abttrg bit. set abttrg bit = 0 clear abttrg bit = 1 set abtclr bit. set abtclr bit = 1 transmit abort transmission start pointer clear? clear trq bit of message buffer undergoing transmission. cautions 1. do not set any tr ansmission requests while abt tran smission abort processing is in progress. 2. make a can sleep mode/can stop mode requ est after the abttrg bit is cleared (after abt mode is stopped) following the procedure shown in figure 19-48 (a) or (b). when clearing a transmission request in an area othe r than the abt area, follow the procedure shown in figure 19-46.
chapter 19 can controller user?s manual u16603ej5v1ud 910 figure 19-49. reception via inte rrupt (using cnlipt register) start end read cnlipt register. dn bit = 0 and muc bit = 0 note yes no clear dn bit. clear dn bit = 1 clear cints1 bit. clear cints1 bit = 1 transmit abort read cnmdataxm, cnmdlcm, cnmidlm, and cnmidhm registers. note check the muc and dn bits using one read access. remark check the mbon bit at the start and end of the in terrupt routine to see if the message buffer and receive history register can be accessed, bec ause a can sleep mode transition request which has been held pending may be under execution. if t he mbon bit is cleared (0), stop the processing under execution. re-execute the processing afte r the mbon bit is set (1) again. it is therefore recommended to cancel the can sleep mode transit ion request before executing reception interrupt servicing.
chapter 19 can controller user?s manual u16603ej5v1ud 911 figure 19-50. reception via inte rrupt (using cnrgpt register) end rovf bit = 1? yes no clear rovf bit. clear rovf bit = 1 rhpm bit = 1? yes start no clear dn bit. clear dn bit = 1 dn bit = 0 and muc bit = 0 note read cnmdataxm, cnmdlcm, cnmidlm, and cnmidhm registers. yes no receive completion interrupt read cnrgpt register. read normal data. read illegal data. note check the muc and dn bits using one read access. remarks 1. check the mbon bit at the start and end of the in terrupt routine to see if the message buffer and receive history register can be accessed, bec ause a can sleep mode transition request which has been held pending may be under execution. if the mbon bit is cleared (0), stop the processing under execution. re-execute the proce ssing after the mbon bit is set (1) again. it is therefore recommended to cancel the can sl eep mode transition request before executing reception interrupt servicing. 2. if the rovf bit has been once set (1), the receive hi story list contradicts. therefore, scan all the receive message buffers that have completed reception.
chapter 19 can controller user?s manual u16603ej5v1ud 912 figure 19-51. reception via software polling start end read cnrgpt register yes no rovf bit = 1? yes no clear rovf bit. clear rovf bit = 1 clear dn bit. clear dn bit = 1 rhpm bit = 1? no yes cints1 bit = 1? no yes clear cints1 bit. clear cints1 bit = 1 read cnmdataxm, cnmdlcm, cnmidlm, and cnmidhm registers. dn bit = 0 and muc bit = 0 note read normal data. read illegal data. note check the muc and dn bits using one read access. remarks 1. check the mbon bit at the start and end of the polling routine to see if the message buffer and receive history register can be accessed, bec ause a can sleep mode transition request which has been held pending may be under execution. if the mbon bit is cleared (0), stop the processing under execution. re-execute the proc essing after the mbon bit is set (1) again. 2. if the rovf bit has been once set (1), the receive hi story list contradicts. therefore, scan all the receive message buffers that have completed reception.
chapter 19 can controller user?s manual u16603ej5v1ud 913 figure 19-52. setting can sleep mode/stop mode start (when psmode[1:0] = 00b) psmode0 = 1? set psmode0 bit set psmode1 bit = 1 clear psmode1 bit = 0 can sleep mode end ye s no set psmode1 bit. set psmode1 bit = 1 clear psmode1 bit = 0 psmode1 = 1? can stop mode request can sleep mode again? set cnctrl register. (set opmode.) ye s no ye s no access to registers other than the cnctrl and cngmctrl registers. init mode? ye s no clear cints5 bit. clear cints5 bit = 1 clear opmode. caution to abort transmission befo re making a request for the can sleep mode, perform processing according to figur es 19-46 to 19-48.
chapter 19 can controller user?s manual u16603ej5v1ud 914 figure 19-53. clear can sleep/stop mode start end clear psmode1 bit. set psmode1 bit = 0 clear psmode1 bit = 1 clear psmode0 bit. set psmode0 bit = 0 clear psmode0 bit = 1 clear cints5 bit. clear cints5 bit = 1 after detect dominant edge psmode0 bit = 0 cints5 bit = 1 (can bus clock not supplied) releasing can sleep mode by can bus active clear cints5 bit. clear cints5 bit = 1 clear psmode0 bit. set psmode0 bit = 0 clear psmode0 bit = 1 (can bus clock supplied note ) releasing can sleep mode by can bus active after detect dominant edge psmode0 bit = 0/1 cints5 bit = 1 can stop mode can sleep mode releasing can sleep mode by user note ?when the can clock is supplied? means a status in which the can sleep mode is set without the cpu standby mode set. ? in stop mode ? in idle1, idle2 modes ? when the main clock is stopped in the s ubclock operation mode or sub-idle mode
chapter 19 can controller user?s manual u16603ej5v1ud 915 figure 19-54. bus-off recovery (other than in normal operation mode with abt) start boff bit = 1? no yes set ccerc bit. set ccerc bit = 1 end no yes set cnctrl register. (clear opmode bit.) access to register other than cnctrl and cngmctrl registers. forced recovery from bus off? set cnctrl register. (set opmode bit.) set cnctrl register. (set opmode bit.) wait for recovery from bus off. clear all trq bits note . note to initialize the message buffer by clearing the rdy bit before starting the bus-off recovery sequence, clear all the trq bits. caution if a request to change the mode from the initialization mode to an y operation mode is made to execute the bus-off recovery sequence agai n during a bus-off recovery sequence, the receive error counter (cnerc.rec0 to cnerc rec6 bits) is cleared. it is therefore necessary to detect 11 contiguous recessive bits 128 times on the bus again. remark opmode: normal operation mode, normal operation mode with abt, receive-only mode, single- shot mode, self-test mode
chapter 19 can controller user?s manual u16603ej5v1ud 916 figure 19-55. bus-off recovery (normal operation mode with abt) start no yes set ccerc register. set ccerc bit = 1 end no yes access to register other than cnctrl and cngmctrl registers. set cnctrl register. (set opmode bit.) set cnctrl register. (set opmode.) clear all trq bit note boff bit = 1? set cnctrl register. (clear opmode bit.) clear abttrg bit. set abttrg bit = 0 clear abttrg bit = 1 forced recovery from bus off? wait for recovery from bus off. note to initialize the message buffer by clearing the rdy bit before starting the bus-off recovery sequence, clear all the trq bits. caution if a request to change the mode from the initialization mode to an y operation mode is made to execute the bus-off recovery sequence agai n during a bus-off recovery sequence, the receive error counter (cnerc.rec0 to cnerc.rec6 bits) is cleared. it is therefore necessary to detect 11 contiguous recessive bits 128 times on the bus again. remark opmode: normal operation mode, normal operation mode with abt, receive-only mode, single- shot mode, self-test mode
chapter 19 can controller user?s manual u16603ej5v1ud 917 figure 19-56. normal shutdown process start clear gom bit. set gom bit = 0 clear gom bit = 1 shutdown successful gom bit = 0, efsd bit = 0 end init mode
chapter 19 can controller user?s manual u16603ej5v1ud 918 figure 19-57. forced shutdown process start set efsd bit. set efsd bit = 1 clear gom bit. set gom bit = 0 clear gom bit = 1 shutdown successful gom bit = 0, efsd bit = 0 end must be a continuous write. gom bit = 0? yes no caution do not read- or write- access any registers by software be tween setting th e efsd bit and clearing the gom bit.
chapter 19 can controller user?s manual u16603ej5v1ud 919 figure 19-58. error handling start cints2 bit = 1? cints3 bit = 1? cints4 bit = 1? clear cints2 bit. clear cints2 bit = 1 end yes no no yes no yes check can module state. (read cninfo register) check can protocol error state. (read cnlec register) clear cints3 bit. clear cints3 bit = 1 clear cints4 bit. clear cints4 bit = 1 error interrupt
chapter 19 can controller user?s manual u16603ej5v1ud 920 figure 19-59. setting cpu standby (from can sleep mode) start set psmode0 bit. set psmode0 bit = 1 clear psmode0 bit = 0 yes no psmode0 bit = 1? can sleep mode set cpu standby mode. end clear cints5 bit. clear cints5 bit = 1 clear psmode0 bit. set psmode0 bit = 0 clear psmode0 bit = 1 yes no mbon bit = 0? yes no cints5 bit 1? note check if the cpu is in the can sleep mode befor e setting it to the standby mode. the can sleep mode may be released by wakeup after it is checked if the cpu is in the can sleep mode and before the cpu is set in the standby mode.
chapter 19 can controller user?s manual u16603ej5v1ud 921 figure 19-60. setting cpu st andby (from can stop mode) start end set psmode0 bit. set psmode0 bit = 1 clear psmode0 bit = 0 psmode0 bit = 1? psmode1 bit = 1? no yes no set psmode1 bit. set psmode1 bit = 1 clear psmode1 bit = 0 clear psmode0 bit. set psmode0 bit = 0 clear psmode0 bit = 1 clear cints5 bit note clear cints5 bit = 1 yes mbon bit = 1? yes no can stop mode set cpu standby mode. can sleep mode note during wakeup interrupts caution the can stop mode can only be released by writing 01 to th e cnctrl.psmode1 and cnctrl.psmode0 bits. it cannot be released by changing the can bus.
user?s manual u16603ej5v1ud 922 chapter 20 dma function (dma controller) the v850es/sj2 and v850es/sj2-h include a direct memory access (dma) controller (dmac) that executes and controls dma transfer. the dmac controls data transfer between memory and i/o, between memo ries, or between i/os based on dma requests issued by the on-chip peripheral i/o (serial in terface, timer/counter, and a/d converter), interrupts from external input pins, or software triggers (memory refers to internal ram or external memory). 20.1 features ? 4 independent dma channels ? transfer unit: 8/16 bits ? maximum transfer count: 65,536 (2 16 ) ? transfer type: two-cycle transfer ? transfer mode: single transfer mode ? transfer requests ? request by interrupts from on-chip peripheral i/o (seria l interface, timer/counter, a/d converter) or interrupts from external input pin ? requests by software trigger ? transfer targets ? internal ram ? peripheral i/o ? peripheral i/o ? peripheral i/o ? internal ram ? external memory ? external memory ? peripheral i/o ? external memory ? external memory
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 923 20.2 configuration cpu internal ram on-chip peripheral i/o on-chip peripheral i/o bus internal bus data control address control count control channel control dmac v850es/sj2, v850es/sj2-h bus interface external bus external ram external rom external i/o dma source address register n (dsanh/dsanl) dma transfer count register n (dbcn) dma channel control register n (dchcn) dma destination address register n (ddanh/ddanl) dma addressing control register n (dadcn) dma trigger factor register n (dtfrn) remark n = 0 to 3
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 924 20.3 registers (1) dma source address registers 0 to 3 (dsa0 to dsa3) the dsa0 to dsa3 registers set the dma source addresse s (26 bits each) for dma channel n (n = 0 to 3). these registers are divided into two 16-bit registers, dsanh and dsanl. these registers can be read or written in 16-bit units. external memory or on-chip peripheral i/o internal ram ir 0 1 specification of dma transfer source set the address (a25 to a16) of the dma transfer source (default value is undefined). during dma transfer, the next dma transfer source address is held. when dma transfer is completed, the dma address set first is held. sa25 to sa16 set the address (a15 to a0) of the dma transfer source (default value is undefined). during dma transfer, the next dma transfer source address is held. when dma transfer is completed, the dma address set first is held. sa15 to sa0 after reset: undefined r/w address: dsa0h fffff082h, dsa1h fffff08ah, dsa2h fffff092h, dsa3h fffff09ah, dsa0l fffff080h, dsa1l fffff088h, dsa2l fffff090h, dsa3l fffff098h dsanl (n = 0 to 3) sa15 sa14 sa13 sa12 sa6 sa5 sa4 sa3 sa2 sa1 sa0 sa7 sa8 sa9 sa10 sa11 dsanh (n = 0 to 3) ir 000 sa22 sa21 sa20 sa19 sa18 sa17 sa16 sa23 sa24 sa25 0 0 cautions 1. be sure to clear bits 14 to 10 of the dsanh register to 0. 2. set the dsanh and dsanl registers at th e following timing wh en dma transfer is disabled (dchcn.enn bit = 0). ? period from after reset to start of first dma transfer ? period from after channel initialization by dchcn.initn bit to start of dma transfer ? period from after completion of dma transfer (dchcn.tcn bit = 1) to start of the next dma transfer 3. when the value of the ds an register is read, two 16-bi t registers, dsanh and dsanl, are read. if reading and updating confli ct, the value being updated may be read (see 20.13 cautions). 4. following reset, set the dsanh, dsanl, ddanh, ddanl, and dbcn registers before starting dma transfer. if these registers ar e not set, the operation when dma transfer is started is not guaranteed.
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 925 (2) dma destination address regi sters 0 to 3 (dda0 to dda3) the dda0 to dda3 registers set the dma destination addre ss (26 bits each) for dma channel n (n = 0 to 3). these registers are divided into two 16-bit registers, ddanh and ddanl. these registers can be read or written in 16-bit units. external memory or on-chip peripheral i/o internal ram ir 0 1 specification of dma transfer destination set an address (a25 to a16) of dma transfer destination (default value is undefined). during dma transfer, the next dma transfer destination address is held. when dma transfer is completed, the dma transfer source address set first is held. da25 to da16 set an address (a15 to a0) of dma transfer destination (default value is undefined). during dma transfer, the next dma transfer destination address is held. when dma transfer is completed, the dma transfer source address set first is held. da15 to da0 after reset: undefined r/w address: dda0h fffff086h, dda1h fffff08eh, da2h fffff096h, dda3h fffff09eh, dda0l fffff084h, dda1l fffff08ch, dda2l fffff094h, dda3l fffff09ch ddanl (n = 0 to 3) da15 da14 da13 da12 da6 da5 da4 da3 da2 da1 da0 da7 da8 da9 da10 da11 ddanh (n = 0 to 3) ir 000 da22 da21 da20 da19 da18 da17 da16 da23 da24 da25 0 0 cautions 1. be sure to clear bits 14 to 10 of the ddanh register to 0. 2. set the ddanh and ddanl registers at the following timing when dma transfer is disabled (dchcn.enn bit = 0). ? period from after reset to start of first dma transfer ? period from after channel initialization by dchcn.initn bit to start of dma transfer ? period from after completion of dma transfer (dchcn.tcn bit = 1) to start of the next dma transfer 3. when the value of the ddan register is read, two 16-bit registers, ddanh and ddanl, are read. if reading and updating conflict , a value being updated may be read (see 20.13 cautions). 4. following reset, set th e dsanh, dsanl, ddanh, ddanl, and dbcn registers before starting dma transfer. if these registers ar e not set, the operation when dma transfer is started is not guaranteed.
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 926 (3) dma byte count registers 0 to 3 (dbc0 to dbc3) the dbc0 to dbc3 registers are 16-bit registers that set the byte transfer c ount for dma channel n (n = 0 to 3). these registers hold the remaining tr ansfer count during dma transfer. these registers are decremented by 1 per one transfer regardless of the trans fer data unit (8/16 bits), and the transfer is terminated if a borrow occurs. these registers can be read or written in 16-bit units. byte transfer count 1 or remaining byte transfer count byte transfer count 2 or remaining byte transfer count : byte transfer count 65,536 (2 16 ) or remaining byte transfer count bc15 to bc0 0000h 0001h : ffffh byte transfer count setting or remaining byte transfer count during dma transfer after reset: undefined r/w address: dbc0 fffff0c0h, dbc1 fffff0c2h, dbc2 fffff0c4h, dbc3 fffff0c6h dbcn (n = 0 to 3) 15 bc15 14 bc14 13 bc13 12 bc12 11 bc11 10 bc10 9 bc9 8 bc8 7 bc7 6 bc6 5 bc5 4 bc4 3 bc3 2 bc2 1 bc1 0 bc0 the number of transfer data set first is held when dma transfer is complete. cautions 1. set the dbcn register at the fo llowing timing when dma transfer is disabled (dchcn.enn bit = 0). ? period from after reset to start of first dma transfer ? period from after channel initialization by dchcn.initn bit to start of dma transfer ? period from after completion of dma transfer (dchcn.tcn bit = 1) to start of the next dma transfer 2. following reset, set the dsanh, dsanl, ddanh, ddanl, and dbcn registers before starting dma transfer. if these registers ar e not set, the operation when dma transfer is started is not guaranteed.
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 927 (4) dma addressing control registers 0 to 3 (dadc0 to dadc3) the dadc0 to dadc3 registers are 16-bit registers that control the dma transfer mode for dma channel n (n = 0 to 3). these registers can be read or written in 16-bit units. reset sets these registers to 0000h. dadcn (n = 0 to 3) 8 bits 16 bits ds0 0 1 setting of transfer data size increment decrement fixed setting prohibited sad1 0 0 1 1 sad0 0 1 0 1 setting of count direction of the transfer source address increment decrement fixed setting prohibited dad1 0 0 1 1 dad0 0 1 0 1 setting of count direction of the destination address after reset: 0000h r/w address: dadc0 fffff0d0h, dadc1 fffff0d2h, dadc2 fffff0d4h, dadc3 fffff0d6h sad1 sad0 dad1 dad0 0 0 0 0 0ds000 00 0 0 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 cautions 1. be sure to clear bits 15, 13 to 8, and 3 to 0 of the dadcn register to 0. 2. set the dadcn register at the followi ng timing when dma transfer is disabled (dchcn.enn bit = 0). ? period from after reset to start of first dma transfer ? period from after channel initialization by dchcn.initn bit to start of dma transfer ? period from after completion of dma transfer (dchcn.tcn bit = 1) to start of the next dma transfer 3. the ds0 bit specifies the size of the transfer data, and do es not control bus sizing. if 8-bit data (ds0 bit = 0) is set, therefor e, the lower data bus is not always used. 4. if the transfer data size is set to 16 bits (ds0 bit = 1), transfer cannot be started from an odd address. transfer is always started from an address with the first bit of the lower address aligned to 0. 5. if dma transfer is executed on an on-chip peripheral i/o register ( as the transfer source or destination), be sure to specify the same transfer size as the register size. for example, to execute dma transfer on an 8-bit register, be sure to specify 8-bit transfer.
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 928 (5) dma channel control registers 0 to 3 (dchc0 to dchc3) the dchc0 to dchc3 registers are 8-bit registers t hat control the dma transfer operating mode for dma channel n. these registers can be read or written in 8-bit or 1-bit units. (however, bit 7 is read-only and bits 1 and 2 are write-only. if bit 1 or 2 is read, the read value is always 0.) reset sets these registers to 00h. dchcn (n = 0 to 3) dma transfer had not completed. dma transfer had completed. it is set to 1 on the last dma transfer and cleared to 0 when it is read. tcn note 1 0 1 status flag indicates whether dma transfer through dma channel n has completed or not dma transfer disabled dma transfer enabled dma transfer is enabled when the enn bit is set to 1. when dma transfer is completed (when a terminal count is generated), this bit is automatically cleared to 0. to abort dma transfer, clear the enn bit to 0 by software. to resume, set the enn bit to 1 again. when aborting or resuming dma transfer, however, be sure to observe the procedure described in 20.13 cautions . enn 0 1 setting of whether dma transfer through dma channel n is to be enabled or disabled this is a software startup trigger of dma transfer. if this bit is set to 1 in the dma transfer enable state (tcn bit = 0, enn bit = 1), dma transfer is started. stgn note 2 after reset: 00h r/w address: dchc0 fffff0e0h, dchc1 fffff0e2h, dchc2 fffff0e4h, dchc3 fffff0e6h tcn note 1 0 0 0 0 initn note 2 stgn note 2 enn <0> <1> <2> 3 4 5 6 <7> initn note 2 if the initn bit is set to 1 with dma transfer disabled (enn bit = 0), the dma transfer status can be initialized. when re-setting the dma transfer status (re-setting the ddanh, ddanl, dsanh, dsanl, dbcn, and dadcn registers) before dma transfer is completed (before the tcn bit is set to 1), be sure to initialize the dma channel. when initializing the dma controller, however, be sure to observe the procedure described in 20.13 cautions . notes 1. the tcn bit is read-only. 2. the initn and stgn bits are write-only. cautions 1. be sure to clear bits 6 to 3 of the dchcn register to 0. 2. when dma transfer is completed (when a terminal count is genera ted), the enn bit is cleared to 0 and then the tcn bi t is set to 1. if the dchcn re gister is read while its bits are being updated, a value indicating ?transfe r not completed and transfer is disabled? (tcn bit = 0 and enn bit = 0) may be read.
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 929 (6) dma trigger factor registers 0 to 3 (dtfr0 to dtfr3) the dtfr0 to dtfr3 registers are 8-bit registers that control the dma transfer start trigger via interrupt request signals from on-chip peripheral i/o. the interrupt request signals set by these re gisters serve as dma transfer start factors. these registers can be read or written in 8-bit units. however, dfn bit can be read or written in 1-bit units. reset sets these registers to 00h. (1/2) dtfrn (n = 0 to 3) no dma transfer request dma transfer request dfn note 0 1 dma transfer request status flag after reset: 00h r/w address: dtfr0 fffff810h, dtfr1 fffff812h, dtfr2 fffff814h, dtfr3 fffff816h dfn 0 ifcn5 ifcn4 ifcn3 ifcn2 ifcn1 ifcn0 0 1 2 3 4 5 6 <7> note do not set the dfn bit to ?1? by software. write 0 to this bit to clear a dma transfer request if an interrupt that is specified as the cause of st arting dma transfer occurs while dma transfer is disabled. cautions 1. set the ifcn5 to if cn0 bits at the following timing when dma transfer is disabled (dchcn.enn bit = 0). ? period from after reset to start of first dma transfer ? period from after channel initialization by dchcn.initn bit to start of dma transfer ? period from after completion of dma transf er (dchcn.tcn bit = 1) to start of the next dma transfer
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 930 (2/2) cautions 2. be sure to follow the steps be low when changing the dtfrn register settings. [v850es/sj2] ? when the values to be set to bits ifcn5 to ifcn0 are not set to bits ifcm5 to ifcm0 of another channel (n = 0 to 3, m = 0 to 3, n m) <1> stop the dman operation of the cha nnel to be rewritten (dchcn.enn bit = 0). <2> change the dtfrn register settings. (b e sure to set dfn bit = 0 and change the settings in the 8-bit manipulation.) <3> confirm that dfn bit = 0. (stop th e interrupt generation source operation beforehand.) <4> enable the dman operation (enn bit = 1). ? when the values to be set to bits ifcn5 to ifcn0 are set to bits ifcm5 to ifcm0 of another channel (n = 0 to 3, m = 0 to 3, n m) <1> stop the dman operation of the cha nnel to be rewritten (dchcn.enn bit = 0). <2> stop the dmam operation of the channel where the same values are set to bits ifcm5 to ifcm0 as the values to be u sed to rewrite bits ifcn5 to ifcn0 (dchcm.emm bit = 0). <3> change the dtfrn register settings. (b e sure to set dfn bit = 0 and change the settings in the 8-bit manipulation.) <4> confirm that bits dfn and dfm = 0. (stop the interrupt generation source operation beforehand.) <5> enable the dman operation (bits enn and emm = 1). [v850es/sj2-h] ? to change the setting of the dtfrn register , be sure to stop dmam of the channel with a priority lower than that of dm an of the channel to be rewritten. <1> stop the dman operation of the cha nnel to be rewritten (dchcn.enn bit = 0). <2> stop dmam of the channel with a priority lower than that of dman of the channel to be rewritten. <3> change the dtfrn register settings. (b e sure to set dfn bit = 0 and change the settings in the 8-bit manipulation.) <4> confirm that bits dfn and dfm = 0. (stop the interrupt generation source operation beforehand.) <5> enable the dman operation (bits enn and emm = 1). 3. an interrupt request that is generated in the standby mode (idel1, idle2, stop, or sub-idle mode) does not start the dma transf er cycle (nor is the dfn bit set to 1). 4. if a dma start factor is selected by the if cn5 to ifcn0 bits, the d fn bit is set to 1 when an interrupt occurs from the selected on-ch ip peripheral i/o, regardless of whether the dma transfer is enabled or disabled. if dma is enabled in this status, dma transfer is immediately started. remark for the ifcn5 to ifcn0 bits, see table 20-1 dma start factors .
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 931 table 20-1. dma start factors (1/2) ifcn5 ifcn4 ifcn3 ifcn2 ifcn1 ifcn0 interrupt source 0 0 0 0 0 0 dma request by interrupt disabled 0 0 0 0 0 1 intp0 0 0 0 0 1 0 intp1 0 0 0 0 1 1 intp2 0 0 0 1 0 0 intp3 0 0 0 1 0 1 intp4 0 0 0 1 1 0 intp5 0 0 0 1 1 1 intp6 0 0 1 0 0 0 intp7 0 0 1 0 0 1 inttq0ov 0 0 1 0 1 0 inttq0cc0 0 0 1 0 1 1 inttq0cc1 0 0 1 1 0 0 inttq0cc2 0 0 1 1 0 1 inttq0cc3 0 0 1 1 1 0 inttp0ov 0 0 1 1 1 1 inttp0cc0 0 1 0 0 0 0 inttp0cc1 0 1 0 0 0 1 inttp1ov 0 1 0 0 1 0 inttp1cc0 0 1 0 0 1 1 inttp1cc1 0 1 0 1 0 0 inttp2ov 0 1 0 1 0 1 inttp2cc0 0 1 0 1 1 0 inttp2cc1 0 1 0 1 1 1 inttp3cc0 0 1 1 0 0 0 inttp3cc1 0 1 1 0 0 1 inttp4cc0 0 1 1 0 1 0 inttp4cc1 0 1 1 0 1 1 inttp5cc0 0 1 1 1 0 0 inttp5cc1 0 1 1 1 0 1 inttm0eq0 0 1 1 1 1 0 intcb0r/intiic1 note 0 1 1 1 1 1 intcb0t 1 0 0 0 0 0 intcb1r 1 0 0 0 0 1 intcb1t 1 0 0 0 1 0 intcb2r 1 0 0 0 1 1 intcb2t 1 0 0 1 0 0 intcb3r 1 0 0 1 0 1 intcb3t 1 0 0 1 1 0 intua0r/intcb4r 1 0 0 1 1 1 intua0t/intcb4t 1 0 1 0 0 0 intua1r/intiic2 note 1 0 1 0 0 1 intua1t 1 0 1 0 1 0 intua2r/intiic0 note note i 2 c bus version (y products) only remark n = 0 to 3
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 932 table 20-1. dma start factors (2/2) ifcn5 ifcn4 ifcn3 ifcn2 ifcn1 ifcn0 interrupt source 1 0 1 0 1 1 intua2t 1 0 1 1 0 0 intad 1 0 1 1 0 1 intkr 1 0 1 1 1 0 interr note 1 0 1 1 1 1 intsta note 1 1 0 0 0 0 intie1 note 1 1 0 0 0 1 intp8 1 1 0 0 1 0 inttp6cc0 1 1 0 0 1 1 inttp6cc1 1 1 0 1 0 0 inttp7cc0 1 1 0 1 0 1 inttp7cc1 1 1 0 1 1 0 inttp8cc0 1 1 0 1 1 1 inttp8cc1 1 1 1 0 0 0 intcb5r 1 1 1 0 0 1 intcb5t 1 1 1 0 1 0 intua3r 1 1 1 0 1 1 intua3t other than above setting prohibited note iebus controller version only remark n = 0 to 3
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 933 20.4 transfer targets table 20-2 shows the relationship between the transfer targets ( : transfer enabled, : transfer disabled). table 20-2. relationship between transfer targets transfer destination internal rom on-chip peripheral i/o internal ram external memory on-chip peripheral i/o internal ram external memory source internal rom caution the operation is not guaranteed for combinat ions of transfer destination and source marked with ? ? in table 20-2. 20.5 transfer modes single transfer is supported as the transfer mode. in single transfer mode, the bus is released at each byte/halfword transfer. if there is a subsequent dma transfer request, transfer is performed again once. this operation continues until a terminal count occurs. when the dmac has released the bus, if another higher priority dma transfer r equest is issued, the higher priority dma request always takes precedence. if a new transfer request of the same channel and a transfer request of another channel with a lower priority are generated in a transfer cycle, dma transfer of the channel with t he lower priority is executed after the bus is released to the cpu (the new transfer request of the same channel is ignored in the transfer cycle).
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 934 20.6 transfer types as a transfer type, the 2-cycle transfer is supported. in two-cycle transfer, data transfer is performed in two cycles, a read cycle and a write cycle. in the read cycle, the transfer source address is output and reading is performed from the source to the dmac. in the write cycle, the transfer destination addr ess is output and writing is performed from the dmac to the destination. an idle cycle of one clock is always inserted between a read cycle and a write cycle. if the data bus width differs between the transfer source and destination for dma transfe r of two cycles, the operation is performed as follows. <16-bit data transfer> <1> transfer from 32-bit bus 16-bit bus a read cycle (the higher 16 bits are in a high-impedan ce state) is generated, followed by generation of a write cycle (16 bits). <2> transfer from 16-/32-bit bus to 8-bit bus a 16-bit read cycle is generated once, and t hen an 8-bit write cycle is generated twice. <3> transfer from 8-bit bus to 16-/32-bit bus an 8-bit read cycle is generated twice, and then a 16-bit write cycle is generated once. <4> transfer between 16-bit bus and 32-bit bus a 16-bit read cycle is generated once, and t hen a 16-bit write cycle is generated once. for dma transfer executed to an on-chip peripheral i/o register (tr ansfer source/destination), be sure to specify the same transfer size as the register size. for example, for dma transfer to an 8-bit register, be sure to specify byte (8- bit) transfer. remark the bus width of each transfer target (tr ansfer source/destination) is as follows. ? on-chip peripheral i/o: 16-bit bus width ? internal ram: 32-bit bus width ? external memory: 8-bit or 16-bit bus width
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 935 20.7 dma channel priorities the dma channel priorities are fixed as follows. dma channel 0 > dma channel 1 > dma channel 2 > dma channel 3 the priorities are checked for every transfer cycle. 20.8 time related to dma transfer the time required to respond to a dma request, and the minimum number of clocks required for dma transfer are shown below. single transfer: dma response time (<1>) + transfer source memory access (<2>) + 1 note 1 + transfer destination memory access (<2>) dma cycle minimum number of execution clocks <1> dma request response time 4 clocks (min.) + noise elimination time note 2 external memory access depends on connected memory. internal ram access 2 clocks note 3 <2> memory access peripheral i/o register access 3 clocks + number of wait cycles specified by vswc register note 4 notes 1. one clock is always inserted between a read cycle and a write cycle in dma transfer. 2. if an external interrupt (intpn) is specified as the tr igger to start dma transfer, noise elimination time is added (n = 0 to 7). 3. two clocks are required for a dma cycle. 4. more wait cycles are necessary for accessing a specific peripheral i/o register (for details, see 3.4.9 (2) ).
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 936 20.9 dma transfer start factors there are two types of dma transfe r start factors, as shown below. (1) request by software if the stgn bit is set to 1 while the dchcn.tcn bit = 0 and enn bit = 1 (dma transfer enabled), dma transfer is started. to request the next dma transfer cycle immediately after that, confirm, by using th e dbcn register, that the preceding dma transfer cycle has been completed, and set the stgn bit to 1 again (n = 0 to 3). tcn bit = 0, enn bit = 1 stgn bit = 1 ? starts the first dma transfer. confirm that the contents of the dbcn register have been updated. stgn bit = 1 ? starts the second dma transfer. : generation of terminal count ? enn bit = 0, tc n bit = 1, and intdman signal is generated. (2) request by on-chip peripheral i/o if an interrupt request is generated from the on-chip peripheral i/o set by the dtfrn register when the dchcn.tcn bit = 0 and enn bit = 1 (dma transf er enabled), dma transfer is started. cautions 1. two start factors (software trigger a nd hardware trigger) cannot be used for one dma channel. if two start factors are simultane ously generated for one dma channel, only one of them is valid. the start factor that is valid cannot be identified. 2. a new transfer request that is generate d after the preceding dma transfer request was generated or in the preceding dma tran sfer cycle is ignored (cleared). 3. the transfer request interval of the sam e dma channel varies depending on the setting of bus wait in the dma transfer cycle, the start status of the other channels, or the external bus hold request. in particular, as described in caution 2, a new transfer request that is generated for the same channel before the dma transfer cycle or during the dma transfer cycle is ignored. therefore, the transfer re quest intervals for the same dma channel must be sufficiently separated by th e system. when the software tr igger is used, completion of the dma transfer cycle that was generated before can be checked by updating the dbcn register.
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 937 20.10 dma abort factors dma transfer is aborted if a bus hold occurs. the same applies if transfer is ex ecuted between the intern al memory/on-chip peripheral i/o and internal memory/on-chip peripheral i/o. when the bus hold is cleared, dma transfer is resumed. 20.11 end of dma transfer when dma transfer has been completed the number of time s set to the dbcn register and when the dchcn.enn bit is cleared to 0 and tcn bit is set to 1, a dma transfer end interrupt request signal (intdman) is generated for the interrupt controller (intc) (n = 0 to 3). the v850es/sj2 and v850es/sj2-h do not output a terminal count signal to an external device. therefore, confirm completion of dma transfer by using the dma transfer end interrupt or polling the tcn bit. 20.12 operation timing figures 20-1 to 20-4 show dma operation timing.
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 938 figure 20-1. priority of dma (1) preparation for transfer read write idle end processing dma2 processing cpu processing dma1 processing cpu processing cpu processing dma0 processing dma0 transfer request system clock dma1 transfer request dma2 transfer request dma transfer mode of processing df0 bit df1 bit df2 bit preparation for transfer read write idle end processing preparation for transfer read remarks 1. transfer in the order of dma0 dma1 dma2 2. in the case of transfer between external memory spaces (multiplexed bus, no wait)
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 939 figure 20-2. priority of dma (2) preparation for transfer read write idle dma0 transfer request system clock dma1 transfer request dma2 transfer request dma transfer mode of processing df0 bit df1 bit df2 bit cpu processing dma0 processing cpu processing dma1 processing cpu processing dma0 processing read write idle end processing read preparation for transfer preparation for transfer end processing remarks 1. transfer in the order of dma0 dma1 dma0 (dma2 is held pending.) 2. in the case of transfer between external memory spaces (multiplexed bus, no wait)
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 940 figure 20-3. period in which dma transfer request is ignored (1) preparation for transfer read cycle write cycle idle end processing dma transfer mode of processing dfn bit system clock transfer request generated after this can be acknowledged dma0 processing cpu processing cpu processing note 2 note 2 dman transfer request note 1 note 2 notes 1. interrupt from on-chip peripheral i/o , or software trigger (stgn bit) 2. new dma request of the same channel is ignor ed between when the first request is generated and the end processing is complete. remark in the case of transfer between external memory spaces (multiplexed bus, no wait)
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 941 figure 20-4. period in which dma transfer request is ignored (2) preparation for transfer read write idle <1> <2> <3> <4> cpu processing dma0 processing cpu processing dma1 processing cpu processing dma0 processing dma0 transfer request system clock dma1 transfer request dma2 transfer request dma transfer mode of processing df0 bit df1 bit df2 bit preparation for transfer read write idle preparation for transfer read end processing end processing <1> dma0 transfer request <2> new dma0 transfer request is generated during dma0 transfer. a dma transfer request of the same channel is ignored during dma transfer. <3> requests for dma0 and dma1 are generated at the same time. dma0 request is ignored (a dma transfer request of the same channel during transfer is ignored). dma1 request is acknowledged. <4> requests for dma0, dma1, and dma2 are generated at the same time. dma1 request is ignored (a dma transfer request of the same channel during transfer is ignored). dma0 request is acknowledged according to priority. dma2 request is held pending (transfer of dma2 occurs next).
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 942 20.13 cautions (1) caution for vswc register when using the dmac, be sure to set an appropriate val ue, in accordance with the operating frequency, to the vswc register. when the default value (77h) of the vsw c register is used, or if an inappr opriate value is set to the vswc register, the operation is not correctly performed (for details of the vswc register, see 3.4.9 (1) (a) system wait control register (vswc) ). (2) caution for dma transfer executed on internal ram when executing the following instructions located in th e internal ram, do not ex ecute a dma transfer that transfers data to/from the internal ram (transfer source/destination), because the cpu may not operate correctly afterward. ? bit manipulation instruction located in internal ram (set1, clr1, or not1) ? data access instruction to misaligned address located in internal ram conversely, when executing a dma transfer to tran sfer data to/from the in ternal ram (transfer source/destination), do not execut e the above two instructions. (3) caution for reading dchcn .tcn bit (n = 0 to 3) the tcn bit is cleared to 0 when it is read, but it is not automat ically cleared even if it is read at a specific timing. to accurately clear the tcn bit, add the following processing. (a) when waiting for completion of dma transfer by polling tcn bit confirm that the tcn bit has been set to 1 (after tcn bit = 1 is read), and then read the tcn bit three more times. (b) when reading tcn bit in interrupt servicing routine execute reading the tcn bit three times.
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 943 (4) dma transfer initialization pro cedure (setting dchcn.initn bit to 1) even if the initn bit is set to 1 when the channel exec uting dma transfer is to be initialized, the channel may not be initialized. to accurately initialize the c hannel, execute either of the following two procedures. (a) temporarily stop transf er of all dma channels initialize the channel executing dma transfer using the procedure in <1> to <7> below. note, however, that tcn bit is cleared to 0 when st ep <5> is executed. make sure that the other processing programs do not expect that the tcn bit is 1. <1> disable interrupts (di). <2> read the dchcn.enn bit of dma channels other t han the one to be forcibly terminated, and transfer the value to a general-purpose register. <3> clear the enn bit of the dma channels used (including the channel to be forcibly terminated) to 0. to clear the enn bit of the last dma channel, execute th e clear instruction twice. if the target of dma transfer (transfer source/destination) is the inte rnal ram, execute the instruction three times. example: execute instructions in t he following order if channels 0, 1, and 2 are used (if the target of transfer is not the internal ram). ? clear dchc0.e00 bit to 0. ? clear dchc1.e11 bit to 0. ? clear dchc2.e22 bit to 0. ? clear dchc2.e22 bit to 0 again. <4> set the initn bit of the channel to be forcibly terminated to 1. <5> read the tcn bit of each channel not to be forcib ly terminated. if both the tcn bit and the enn bit read in <2> are 1 (logical product (and) is 1), clear the saved enn bit to 0. <6> after the operation in <5>, write the enn bit value to the dchcn register. <7> enable interrupts (ei). caution be sure to execute step <5> above to prevent illegal setting of the enn bit of the channels whose dma transfer has been normall y completed between <2> and <3>.
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 944 (b) repeatedly execute setting initn bit until transfer is forcibly terminated correctly <1> suppress a request from the dma request source of the channel to be forcibly terminated (stop operation of the on-ch ip peripheral i/o). <2> check that the dma transfer request of the channel to be forcibly terminated is not held pending, by using the dtfrn.dfn bit. if a dma transfer reques t is held pending, wait until execution of the pending request is completed. <3> when it has been confirmed that t he dma request of the channel to be fo rcibly terminated is not held pending, clear the enn bit to 0. <4> again, clear the enn bit of the channel to be forcibly terminated. if the target of transfer for the channel to be forc ibly terminated (transfer source/destination) is the internal ram, execute th is operation once more. <5> copy the initial number of trans fers of the channel to be forcibly terminated to a general-purpose register. <6> set the initn bit of the channel to be forcibly terminated to 1. <7> read the value of the dbcn regist er of the channel to be forcibly terminated, and compare it with the value copied in <5>. if the two values do not match, repeat operations <6> and <7>. remarks 1. when the value of the dbcn register is read in <7>, the initial number of transfers is read if forced termination has been correctly completed. if not, the remaining number of transfers is read. 2. note that method (b) may take a long time if the application frequently uses dma transfer for a channel other than the dma channel to be forcibly terminated. (5) procedure of temporarily stoppi ng dma transfer (clearing enn bit) stop and resume the dma transfer under ex ecution using the following procedure. <1> suppress a transfer request from the dma request s ource (stop the operation of the on-chip peripheral i/o). <2> check the dma transfer request is not held pending , by using the dfn bit (check if the dfn bit = 0). if a request is pending, wait until execution of the pending dma transfer request is completed. <3> if it has been confirmed that no dma transfer requ est is held pending, clear the enn bit to 0 (this operation stops dma transfer). <4> set the enn bit to 1 to resume dma transfer. <5> resume the operation of the dma request source that has been stopped (start the operation of the on- chip peripheral i/o). (6) memory boundary the operation is not guaranteed if th e address of the transfer source or destination exceeds the area of the dma target (external memory, internal ram, or on-chip peripheral i/o) during dma transfer. (7) transferring misaligned data dma transfer of misaligned data with a 16-bit bus width is not supported. if an odd address is specified as the trans fer source or destination, the leas t significant bit of the address is forcibly assumed to be 0.
chapter 20 dma function (dma controller) user?s manual u16603ej5v1ud 945 (8) bus arbitration for cpu because the dma controller has a higher priority bus ma stership than the cpu, a cpu access that takes place during dma transfer is held pending unt il the dma transfer cycle is complete d and the bus is released to the cpu. however, the cpu can access the internal rom and internal ram for which dma transfer is not being executed. ? the cpu can access the internal rom and internal ram when dma transfer is being executed between the external memory and on-chip peripheral i/o. ? the cpu can access the internal rom when dma transfer is being executed between the on-chip peripheral i/o and internal ram. (9) registers/bits that must not be rewritten during dma operation set the following registers at the following ti ming when a dma operation is not under execution. [registers] ? dsanh, dsanl, ddanh, ddanl, dbcn, and dadcn registers ? dtfrn.ifcn5 to dtfrn.ifcn0 bits [timing of setting] ? period from after reset to start of the first dma transfer ? time after channel initializ ation to start of dma transfer ? period from after completion of dma transfer (tcn bit = 1) to start of the next dma transfer (10) be sure to set the foll owing register bits to 0. ? bits 14 to 10 of dsanh register ? bits 14 to 10 of ddanh register ? bits 15, 13 to 8, and 3 to 0 of dadcn register ? bits 6 to 3 of dchcn register (11) dma start factor care must be exercised when setting the same start trigger for multiple dma channels. if dma transfers via such dma channels are activat ed, the dma channel with a lower priority may be acknowledged prior to the dma channel with a higher priority. (12) read values of dsan and ddan registers values in the middle of updating may be read from t he dsan and ddan registers during dma transfer (n = 0 to 3). for example, if the dsanh regist er and then the dsanl register ar e read when the dma transfer source address (dsan register) is 0000ffffh and the count direction is incremental (dadcn.sad1 and dadcn.sad0 bits = 00), the value of the dsan regist er differs as follows, depending on whether dma transfer is executed immediately after the dsanh register is read. (a) if dma transfer does not occu r while dsan register is read <1> read value of dsanh register: dsanh = 0000h <2> read value of dsanl register: dsanl = ffffh (b) if dma transfer occurs while dsan register is read <1> read value of dsanh register: dsanh = 0000h <2> occurrence of dma transfer <3> incrementing dsan register: dsan = 00100000h <4> read value of dsanl register: dsanl = 0000h
user?s manual u16603ej5v1ud 946 chapter 21 crc function 21.1 functions ? crc operation circuit for detection of data block errors ? generation of 16-bit crc code using a crc-ccitt (x 16 + x 12 + x 5 + 1) generation polynomial for blocks of data of any length in 8-bit units ? crc code is set to the crc data register each time 1-by te data is transferred to the crcin register, after the initial value is set to the crcd register. 21.2 configuration the crc function includes the following hardware. table 21-1. crc configuration item configuration control registers crc input register (crcin) crc data register (crcd) figure 21-1. block diagram of crc register crc data register (crcd) (16 bits) crc input register (crcin) (8 bits) internal bus internal bus crc code generator
chapter 21 crc function user?s manual u16603ej5v1ud 947 21.3 registers (1) crc input register (crcin) the crcin register is an 8-bit register for setting data. this register can be read or written in 8-bit units. reset sets this register to 00h. crcin 654321 after reset: 00h r/w address: fffff310h 7 0 (2) crc data register (crcd) the crcd register is a 16-bit register that stores the crc-ccitt operation results. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the crcd register is prohibited in the following statuses. for details, see 3.4.9 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock a nd the main clock oscillation is stopped ? when the cpu operates with th e internal oscillation clock crcd 12 10 8 6 4 2 after reset: 0000h r/w address: fffff312h 14 0 13 11 9 7 5 3 15 1
chapter 21 crc function user?s manual u16603ej5v1ud 948 21.4 operation an example of the crc operation circuit is shown below. figure 21-2. crc operation circui t operation example (lsb first) (1) setting of crcin = 01h 1189h b15 b0 b0 b7 crc code is stored (2) crcd register read the code when 01h is sent lsb first is (1000 0000). therefore, the crc code from generation polynomial x 16 + x 12 + x 5 + 1 becomes the remainder when (1000 0000) x 16 is divided by (1 0001 0000 0010 0001) using the modulo-2 operation formula. the modulo-2 operation is performed based on the following formula. 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 ? 1 = 1 1 0001 0000 0010 0001 1000 0000 0000 0000 0000 0000 1000 1000 0001 0000 1 1000 0001 0000 1000 0 1000 1000 0001 0000 1 1001 0001 1000 1000 1000 1000 lsb lsb msb msb therefore, the crc code becomes . since lsb first is used, this corresponds to 1189h in hexadecimal notation. 1001 9811 0001 1000 1000
chapter 21 crc function user?s manual u16603ej5v1ud 949 21.5 usage how to use the crc logic circuit is described below. figure 21-3. crc operation flow start write of 0000h to crcd register crcd register read crcin register write yes no input data exists? end [basic usage method] <1> write 0000h to the crcd register. <2> write the required quantity of data to the crcin register. <3> read the crcd register.
chapter 21 crc function user?s manual u16603ej5v1ud 950 communication errors can easily be det ected if the crc code is transmitted/ received along with transmit/receive data when transmitting/receiving data consisting of several bytes. the following is an illustration using the transmission of 12345678h (0001 0010 0011 0100 0101 0110 0111 1000b) lsb-first as an example. figure 21-4. crc transmission example 78 transmit/receive data (12345678h) crc code (08f6h) 56 34 12 f6 08 setting procedure on transmitting side <1> write the initial value 0000h to the crcd register. <2> write the 1 byte of data to be transmitted first to the transmit buffer register. (at this time, also write the same data to the crcin register.) <3> when transmitting several bytes of data, write t he same data to the crcin register each time transmit data is written to the transmit buffer register. <4> after all the data has been transmitted, write t he contents of the crcd regi ster (crc code) to the transmit buffer register and transmit them. (since this is lsb first, transmit the data starting from the lower bytes, then the higher bytes.) setting procedure on receiving side <1> write the initial value 0000h to the crcd register. <2> when reception of the first 1 byte of data is comp lete, write that receive data to the crcin register. <3> if receiving several bytes of data, write the rece ive data to the crcin register upon every reception completion. (in the case of normal reception, w hen all the receive data has been written to the crcin register, the contents of the crcd re gister on the receiving side and t he contents of the crcd register on the transmitting side are the same.) <4> next, the crc code is transmitted from the transmi tting side, so write this data to the crcin register similarly to receive data. <5> when reception of all the data, including the crc c ode, has been completed, reception was normal if the contents of the crcd register are 0000 h. if the contents of the crcd re gister are other than 0000h, this indicates a communication error, so transmit a resend request to the transmitting side.
user?s manual u16603ej5v1ud 951 chapter 22 interrupt/except ion processing function the v850es/sj2 and v850es/sj2-h are provided with a de dicated interrupt controller (intc) for interrupt servicing and can process a total of 70 to 79 interrupt requests. an interrupt is an event that occurs independently of program execution, and an ex ception is an event whose occurrence is dependent on program execution. the v850es/sj2 and v850es/sj2-h can process interrupt request signals from the on-chip peripheral hardware and external sources. moreover, exception processing can be started by the trap instructi on (software exception) or by generation of an exception event (i.e. fe tching of an illegal opcode) (exception trap). 22.1 features interrupts ? non-maskable interrupts: 2 sources ? maskable interrupts: external: 9, internal: 59/60/63/64/67/68 sources (see table 1-1 ) ? 8 levels of programmable priorities (maskable interrupts) ? multiple interrupt control according to priority ? masks can be specified for eac h maskable interrupt request. ? noise elimination, edge detection, and valid edge specification for external interrupt request signals. exceptions ? software exceptions: 32 sources ? exception trap: 2 sources (illegal opcode exception, debug trap) interrupt/exception sources are listed in table 22-1.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 952 table 22-1. interrupt source list (1/4) type classification default priority name trigger generating unit exception code handler address restored pc interrupt control register reset interrupt ? reset reset pin input reset input by internal source reset 0000h 00000000h undefined ? ? nmi nmi pin valid edge input pin 0010h 00000010h nextpc ? non- maskable interrupt ? intwdt2 wdt2 overflow wdt2 0020h 00000020h note 1 ? ? trap0n note 2 trap instruction ? 004nh note 2 00000040h nextpc ? software exception exception ? trap1n note 2 trap instruction ? 005nh note 2 00000050h nextpc ? exception trap exception ? ilgop/ dbg0 illegal opcode/ dbtrap instruction ? 0060h 00000060h nextpc ? 0 intlvi note 3 low voltage detection pocl vi 0080h 00000080h nextpc lviic 1 intp0 external interrupt pin input edge detection (intp0) pin 0090h 00000090h nextpc pic0 2 intp1 external interrupt pin input edge detection (intp1) pin 00a0h 000000a0h nextpc pic1 3 intp2 external interrupt pin input edge detection (intp2) pin 00b0h 000000b0h nextpc pic2 4 intp3 external interrupt pin input edge detection (intp3) pin 00c0h 000000c0h nextpc pic3 5 intp4 external interrupt pin input edge detection (intp4) pin 00d0h 000000d0h nextpc pic4 6 intp5 external interrupt pin input edge detection (intp5) pin 00e0h 000000e0h nextpc pic5 7 intp6 external interrupt pin input edge detection (intp6) pin 00f0h 000000f0h nextpc pic6 8 intp7 external interrupt pin input edge detection (intp7) pin 0100h 00000100h nextpc pic7 9 inttq0ov tmq0 overflow tmq0 0110h 00000110h nextpc tq0ovic 10 inttq0cc0 tmq0 capture 0/ compare 0 match tmq0 0120h 00000120h nextpc tq0ccic0 11 inttq0cc1 tmq0 capture 1/ compare 1 match tmq0 0130h 00000130h nextpc tq0ccic1 12 inttq0cc2 tmq0 capture 2/ compare 2 match tmq0 0140h 00000140h nextpc tq0ccic2 13 inttq0cc3 tmq0 capture 3/ compare 3 match tmq0 0150h 00000150h nextpc tq0ccic3 14 inttp0ov tmp0 overflow tmp0 0160h 00000160h nextpc tp0ovic 15 inttp0cc0 tmp0 capture 0/ compare 0 match tmp0 0170h 00000170h nextpc tp0ccic0 16 inttp0cc1 tmp0 capture 1/ compare 1 match tmp0 0180h 00000180h nextpc tp0ccic1 maskable interrupt 17 inttp1ov tmp1 overflow tmp1 0190h 00000190h nextpc tp1ovic notes 1. for the restoring in the case of intwdt2, see 22.2.2 (2) intwdt2 signal . 2. n = 0 to fh 3. v850es/sj2 only
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 953 table 22-1. interrupt source list (2/4) type classification default priority name trigger generating unit exception code handler address restored pc interrupt control register 18 inttp1cc0 tmp1 capture 0/ compare 0 match tmp1 01a0h 000001a0h nextpc tp1ccic0 19 inttp1cc1 tmp1 capture 1/ compare 1 match tmp1 01b0h 000001b0h nextpc tp1ccic1 20 inttp2ov tmp2 overflow tmp2 01c0h 000001c0h nextpc tp2ovic 21 inttp2cc0 tmp2 capture 0/ compare 0 match tmp2 01d0h 000001d0h nextpc tp2ccic0 22 inttp2cc1 tmp2 capture 1/ compare 1 match tmp2 01e0h 000001e0h nextpc tp2ccic1 23 inttp3ov tmp3 overflow tmp3 01f0h 000001f0h nextpc tp3ovic 24 inttp3cc0 tmp3 capture 0/ compare 0 match tmp3 0200h 00000200h nextpc tp3ccic0 25 inttp3cc1 tmp3 capture 1/ compare 1 match tmp3 0210h 00000210h nextpc tp3ccic1 26 inttp4ov tmp4 overflow tmp4 0220h 00000220h nextpc tp4ovic 27 inttp4cc0 tmp4 capture 0/ compare 0 match tmp4 0230h 00000230h nextpc tp4ccic0 28 inttp4cc1 tmp4 capture 1/ compare 1 match tmp4 0240h 00000240h nextpc tp4ccic1 29 inttp5ov tmp5 overflow tmp5 0250h 00000250h nextpc tp5ovic 30 inttp5cc0 tmp5 capture 0/ compare 0 match tmp5 0260h 00000260h nextpc tp5ccic0 31 inttp5cc1 tmp5 capture 1/ compare 1 match tmp5 0270h 00000270h nextpc tp5ccic1 32 inttm0eq0 tmm0 compare match tmm0 0280h 00000280h nextpc tm0eqic0 33 intcb0r/ intiic1 note csib0 reception completion/ csib0 reception error/ iic1 transfer completion csib0/ iic1 0290h 00000290h nextpc cb0ric/ iicic1 34 intcb0t csib0 consecutive transmission write enable csib0 02a0h 000002a0h nextpc cb0tic 35 intcb1r csib1 reception completion/ csib1 reception error csib1 02b0h 000002b0h nextpc cb1ric 36 intcb1t csib1 consecutive transmission write enable csib1 02c0h 000002c0h nextpc cb1tic 37 intcb2r csib2 reception completion/ csib2 reception error csib2 02d0h 000002d0h nextpc cb2ric 38 intcb2t csib2 consecutive transmission write enable csib2 02e0h 000002e0h nextpc cb2tic 39 intcb3r csib3 reception completion/ csib3 reception error csib3 02f0h 000002f0h nextpc cb3ric maskable interrupt 40 intcb3t csib3 consecutive transmission write enable csib3 0300h 00000300h nextpc cb3tic note i 2 c bus versions (y products) only
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 954 table 22-1. interrupt source list (3/4) type classification default priority name trigger generating unit exception code handler address restored pc interrupt control register 41 intua0r/ intcb4r uarta0 reception completion/ csib4 reception completion/ csib4 reception error uarta0/ csib4 0310h 00000310h nextpc ua0ric/c b4ric 42 intua0t/ intcb4t uarta0 consecutive transmission enable/ csib4 consecutive transmission write enable uarta0/ csib4 0320h 00000320h nextpc ua0tic/ cb4tic 43 intua1r/ intiic2 note 1 uarta1 reception completion/ uarta1 reception error/ iic2 transfer completion uarta1/ iic2 0330h 00000330h nextpc ua1ric/ iicic2 44 intua1t uarta1 consecutive transmission enable uarta1 0340h 00000340h nextpc ua1tic 45 intua2r/ intiic0 note 1 uarta2 reception completion/ iic0 transfer completion uarta/ iic0 0350h 00000350h nextpc ua2ric/ iicic0 46 intua2t uarta2 consecutive transmission enable uarta2 0360h 00000360h nextpc ua2tic 47 intad a/d conversion comple tion a/d 0370h 00000370h nextpc adic 48 intdma0 dma0 transfer completi on dma 0380h 00000380h nextpc dmaic0 49 intdma1 dma1 transfer completi on dma 0390h 00000390h nextpc dmaic1 50 intdma2 dma2 transfer completion dma 03a0h 000003a0h nextpc dmaic2 51 intdma3 dma3 transfer completion dma 03b0h 000003b0h nextpc dmaic3 52 intkr key return interrupt kr 03c0h 000003c0h nextpc kric 53 intwti watch timer interval wt 03d0h 000003d0h nextpc wtiic 54 intwt watch timer reference time wt 03e0h 000003e0h nextpc wtic 55 intc0err note 2 / interr note 3 afcan0 error/iebus error afcan0/ iebus 03f0h 000003f0h nextpc erric0/ erric 56 intc0wup note 2 / intsta note 3 afcan0 wakeup/ iebus status afcan0/ iebus 0400h 00000400h nextpc wupic0/ stsaic 57 intc0rec note 2 / intie1 note 3 afcan0 reception/ iebus data interrupt afcan0/ iebus 0410h 00000410h nextpc recic0/ ieic1 58 intc0trx note 2 / intie2 note 3 afcan0 transmission/ iebus error/iebus status afcan0/ iebus 0420h 00000420h nextpc trxic0/ ieic2 59 intc1err note 4 afcan1 error afcan1 0430h 00000430h nextpc erric1 60 intc1wup note 4 afcan1 wakeup afcan1 0440h 00000440h nextpc wupic1 61 intc1rec note 4 afcan1 reception afcan1 0450h 00000450h nextpc recic1 62 intc1trx note 4 afcan1 transmission afcan1 0460h 00000460h nextpc trxic1 63 intp8 external interrupt pin input edge detection (intp8) pin 0470h 00000470h nextpc pic8 maskable interrupt 64 inttp6ov tmp6 overflow tmp6 0480h 00000480h nextpc tp6ovic notes 1. i 2 c bus versions (y products) only 2. can controller version only 3. iebus controller version only 4. can controller (2-channel) version only
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 955 table 22-1. interrupt source list (4/4) type classification default priority name trigger generating unit exception code handler address restored pc interrupt control register 65 inttp6cc0 tmp6 capture 0/ compare 0 match tmp6 0490h 00000490h nextpc tp6ccic0 66 inttp6cc1 tmp6 capture 1/ compare 1 match tmp6 04a0h 000004a0h nextpc tp6ccic1 67 inttp7ov tmp7 overflow tmp7 04b0h 000004b0h nextpc tp7ovic 68 inttp7cc0 tmp7 capture 0/ compare 0 match tmp7 04c0h 000004c0h nextpc tp7ccic0 69 inttp7cc1 tmp7 capture 1/ compare 1 match tmp7 04d0h 000004d0h nextpc tp7ccic1 70 inttp8ov tmp8 overflow tmp8 04e0h 000004e0h nextpc tp8ovic 71 inttp8cc0 tmp8 capture 0/ compare 0 match tmp8 04f0h 000004f0h nextpc tp8ccic0 72 inttp8cc1 tmp8 capture 1/ compare 1 match tmp8 0500h 00000500h nextpc tp8ccic1 73 intcb5r csib5 reception completi on csib5 0510h 00000510h nextpc cb5ric 74 intcb5t csib5 consecutive transmission write enable csib5 0520h 00000520h nextpc cb5tic 75 intua3r uarta3 reception completion uarta3 0530h 00000530h nextpc ua3ric maskable interrupt 76 intua3t uarta3 consecutive transmission enable uarta3 0540h 00000540h nextpc ua3tic remarks 1. default priority: the priority order when two or more maskable interrupt requests occur at the same time. the highest priority is 0. the priority order of non-maskable interrupt is intwdt2 > nmi. restored pc: the value of the program count er (pc) saved to eipc, fepc, or dbpc when interrupt servicing is started. note, however, that the restored pc when a non- maskable or maskable interrupt is acknowledged while one of the following instructions is being executed does not become the nextpc (if an interrupt is acknowledged during interrupt execution, execution stops, and then resumes after the interrupt servicing has finished). ? load instructions (sld.b, sld.bu, sld.h, sld.hu, sld.w) ? division instructions (div, divh, divu, divhu) ? prepare, dispose instructions (only if an interrupt is generated before the stack pointer is updated) nextpc: the pc value that starts the proc essing following interrupt/exception processing. 2. the execution address of the illegal instruction when an illegal opcode exception occurs is calculated by (restored pc ? 4).
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 956 22.2 non-maskable interrupts a non-maskable interrupt request signal is acknowledged unconditionally, even when interrupts are in the interrupt disabled (di) status. an nmi is not subject to priority control and takes precedence over all the other interrupt request signals. this product has the following two non-maskable interrupt request signals. ? nmi pin input (nmi) ? non-maskable interrupt request signal generated by overflow of watchdog timer (intwdt2) the valid edge of the nmi pin can be selected from four types: ?rising edge? , ?falling edge?, ?both edges?, and ?no edge detection?. the non-maskable interrupt request signal generated by overflow of the watchdog timer 2 (intwdt2) functions when the wdtm2.wdm21 and wdtm2.wdm20 bits are set to ?01?. if two or more non-maskable interrupt request signals occur at the same time, the interrupt with the higher priority is serviced, as follows (the interrupt reques t signal with the lower priority is ignored). intwdt2 > nmi if a new nmi or intwdt2 request signal is issued while a nmi is being serviced, it is serviced as follows. (1) if new nmi request signal is i ssued while nmi is being serviced the new nmi request signal is held pending, regardle ss of the value of the psw.np bit. the pending nmi request signal is acknowledged after the nmi currently under execution has been serviced (after the reti instruction has been executed). (2) if intwdt2 request signal is issued while nmi is being serviced the intwdt2 request signal is held pending if the np bit remains set (1) while the nmi is being serviced. the pending intwdt2 request signal is acknowledged after the nmi currently under execution has been serviced (after the reti instruction has been executed). if the np bit is cleared (0) while the nmi is being serviced, the newly generated intwdt2 request signal is executed (the nmi servicing is stopped). caution for the non-maskable in terrupt servicing executed by th e non-maskable interrupt request signal (intwdt2), see 22.2.2 (2) intwdt2 signal. figure 22-1. non-maskable interrupt requ est signal acknowledgment operation (1/2) (a) nmi and intwdt2 request signa ls generated at the same time main routine system reset nmi and intwd t2 requests (generated simultaneously) intwd t2 servicing
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 957 figure 22-1. non-maskable interrupt requ est signal acknowledgment operation (2/2) (b) non-maskable interrupt request signal ge nerated during non-maskab le interrupt servicing non-maskable interrupt being serviced non-maskable interrupt request signal generated during non-maskable interrupt servicing nmi intwdt2 nmi ? nmi request generated during nmi servicing ? intwdt2 request generated during nmi servicing (np bit = 1 retained before intwdt2 request) main routine nmi request nmi servicing (held pending) servicing of pending nmi nmi request main routine system reset nmi request nmi servicing (held pending) intwdt2 servicing intwdt2 request ? intwdt2 request generated during nmi servicing (np bit = 0 set before intwdt2 request) main routine system reset nmi request nmi servicing intwdt2 servicing intwdt2 request np = 0 ? intwdt2 request generated during nmi servicing (np = 0 set after intwdt2 request) main routine system reset nmi request nmi servicing intwdt2 servicing np = 0 ? intwdt2 request generated during intwdt2 servicing main routine system reset intwdt2 request intwdt2 servicing (invalid) ? nmi request generated during intwdt2 servicing intwdt2 main routine system reset intwdt2 request intwdt2 servicing (invalid) nmi request (held pending) intwdt2 request intwdt2 request
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 958 22.2.1 operation if a non-maskable interrupt request signal is generated, the cpu performs the following processing, and transfers control to the handler routine. <1> saves the restored pc to fepc. <2> saves the current psw to fepsw. <3> writes exception code (0010h, 0020h) to the higher halfword (fecc) of ecr. <4> sets the psw.np and psw.id bits to 1 and clears the psw.ep bit to 0. <5> sets the handler address (00000010h, 00000020h) corresponding to the non-maskable interrupt to the pc, and transfers control. the servicing configuration of a non-maska ble interrupt is shown in figure 22-2. figure 22-2. servicing configur ation of non-maskable interrupt psw.np fepc fepsw ecr.fecc psw.np psw.ep psw.id pc restored pc psw 0010h, 0020h 1 0 1 00000010h, 00000020h 1 0 nmi input non-maskable interrupt request interrupt servicing interrupt request held pending intc acknowledged cpu processing
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 959 22.2.2 restore (1) from nmi pin input execution is restored from the nmi se rvicing by the reti instruction. when the reti instruction is execut ed, the cpu performs the following proc essing, and transfers control to the address of the restored pc. <1> loads the restored pc and psw from fepc and fepsw, respectively , because the psw.ep bit is 0 and the psw.np bit is 1. <2> transfers control back to the address of the restored pc and psw. figure 22-3 illustrates how the reti instruction is processed. figure 22-3. reti instruction processing psw.ep reti instruction psw.np original processing restored 1 1 0 0 pc psw eipc eipsw pc psw fepc fepsw caution when the ep and np bits are changed by the ldsr instruction during non-maskable interrupt servicing, in order to restore the pc and psw correctly during recovery by the reti instruction, it is necessary to set the ep bit back to 0 and the np bit back to 1 using the ldsr instruction immediately before the reti instruction. remark the solid line shows the cpu processing flow.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 960 (2) from intwdt2 signal restoring from non-maskable interrupt servicing exec uted by the non-maskable interrupt request (intwdt2) by using the reti instruction is disabled. execute the following software reset processing. figure 22-4. software reset processing intwdt2 occurs. fepc software reset processing address fepsw value that sets np bit = 1, ep bit = 0 reti reti 10 times (fepc and fepsw note must be set.) psw psw default value setting initialization processing intwdt2 servicing routine software reset processing routine note fepsw value that sets np bit = 1, ep bit = 0 22.2.3 np flag the np flag is a status flag that indicates that non -maskable interrupt servicing is under execution. this flag is set when a non-maskable interrupt request signal has been acknowledged, and masks non-maskable interrupt requests to prohibit multiple interrupts from being acknowledged. 0 np ep id sat cy ov s z psw no non-maskable interrupt servicing non-maskable interrupt currently being serviced np 0 1 non-maskable interrupt servicing status after reset: 00000020h
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 961 22.3 maskable interrupts maskable interrupt request signals can be masked by interr upt control registers. t he v850es/sj2, v850es/sj2-h has 68 to 77 maskable interrupt sources. if two or more maskable interrupt request signals ar e generated at the same ti me, they are acknowledged according to the default pr iority. in addition to the default priority, eight levels of priorities can be specified by using the interrupt control registers (p rogrammable priority control). when an interrupt request signal has been acknowledged, the acknowledgment of other maskable interrupt request signals is disabled and the interrupt disabled (di) status is set. when the ei instruction is executed in an interrupt service routine, the interr upt enabled (ei) status is set, which enables servicing of interrupts having a higher priority t han the interrupt request signal in progress (specified by the interrupt control register). note that only interrupts with a higher priority will have this capability; interrupts with the same priority level cannot be nested. to enable multiple interrupts, however, save eipc and eipsw to memory or general-purpose registers before executing the ei instruction, and execute the di instruction bef ore the reti instruction to re store the original values of eipc and eipsw. 22.3.1 operation if a maskable interrupt occurs, the cpu performs the fo llowing processing, and transfers control to a handler routine. <1> saves the restored pc to eipc. <2> saves the current psw to eipsw. <3> writes an exception code to the lower halfword of ecr (eicc). <4> sets the psw. id bit to 1 and clears the psw. ep bit to 0. <5> sets the handler address corresponding to each interrupt to the pc, and transfers control. the maskable interrupt request signal masked by intc and the maskable interrupt request signal generated while another interrupt is being serviced (while the psw.np bit = 1 or the psw.id bit = 1) are held pending inside intc. in this case, servicing a new maskable interrupt is start ed in accordance with the priority of the pending maskable interrupt request signal if either the maskable interrupt is unmasked or the np and id bits are cleared to 0 by using the reti or ldsr instruction. how maskable interrupts are serviced is illustrated below.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 962 figure 22-5. maskable interrupt servicing int input xxif = 1 no xxmk = 0 no is the interrupt mask released? yes yes no no no maskable interrupt request interrupt request held pending psw.np psw.id 1 1 interrupt request held pending 0 0 interrupt servicing cpu processing intc acknowledged yes yes yes priority higher than that of interrupt currently being serviced? priority higher than that of other interrupt request? highest default priority of interrupt requests with the same priority? eipc eipsw ecr.eicc psw.ep psw.id corresponding bit of ispr note pc restored pc psw exception code 0 1 1 handler address interrupt requested? note for the ispr register, see 22.3.6 in-service priority register (ispr) .
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 963 22.3.2 restore recovery from maskable interrupt servicing is carried out by the reti instruction. when the reti instruction is executed , the cpu performs the following steps, and transfers control to the address of the restored pc. <1> loads the restored pc and psw from eipc and eipsw because the psw.ep bit is 0 and the psw.np bit is 0. <2> transfers control to the address of the restored pc and psw. figure 22-6 illustrates the proce ssing of the reti instruction. figure 22-6. reti instruction processing psw.ep reti instruction psw.np restores original processing 1 1 0 0 pc psw corresponding bit of ispr note eipc eipsw 0 pc psw fepc fepsw note for the ispr register, see 22.3.6 in-service priority register (ispr) . caution when the ep and np bits are changed by the ldsr instruction during maskable interrupt servicing, in order to restore the pc and psw correctly during recovery by the reti instruction, it is necessary to set the ep bit back to 0 and the np bit back to 0 using the ldsr instruction immediately befo re the reti instruction. remark the solid line shows the cpu processing flow.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 964 22.3.3 priorities of maskable interrupts the intc performs multiple interrupt servicing in which an interrupt is acknowledged while another interrupt is being serviced. multiple interrupts can be controlled by priority levels. there are two types of priority level c ontrol: control based on the default pr iority levels, and control based on the programmable priority levels that are spec ified by the interrupt priority level s pecification bit (xxprn) of the interrupt control register (xxicn). when two or more interrupts hav ing the same priority level specified by the xxprn bit are generated at the same time, interrupt request signals are se rviced in order depending on the priority level allocated to each interrupt request type (default priority leve l) beforehand. for more information, see table 22-1 interrupt/exception source list . the programmable priority control custom izes interrupt request signals into eight levels by setting the priority level specification flag. note that when an interrupt request signal is acknowled ged, the psw.id flag is automatica lly set to 1. therefore, when multiple interrupts are to be used, clear the id flag to 0 beforehand (for example, by placing the ei instruction in the interrupt service program) to set the interrupt enable mode. remark xx: identification name of each peripheral unit (see table 22-2 interrupt control register (xxicn) ) n: peripheral unit number (see table 22-2 interrupt control register (xxicn) ).
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 965 figure 22-7. example of processing in which another interrupt request signal is issued while an interrupt is being serviced (1/2) main routine ei ei interrupt request a (level 3) servicing of a servicing of b servicing of c interrupt request c (level 3) servicing of d servicing of e ei interrupt request e (level 2) servicing of f ei servicing of g interrupt request g (level 1) interrupt request h (level 1) servicing of h interrupt request b is acknowledged because the priority of b is higher than that of a and interrupts are enabled. although the priority of interrupt request d is higher than that of c, d is held pending because interrupts are disabled. interrupt request f is held pending even if interrupts are enabled because its priority is lower than that of e. interrupt request h is held pending even if interrupts are enabled because its priority is the same as that of g. interrupt request b (level 2) interrupt request d (level 2) interrupt request f (level 3) caution to perform multiple interrupt servicing, the values of the eipc and eipsw registers must be saved before executing the ei instruction. when returning from multiple interrupt servicing, restore the values of eipc and eipsw after executing the di instruction. remarks 1. a to u in the figure are the temporary names of interrupt request signals shown for the sake of explanation. 2. the default priority in the figure indicates the relative priority between two interrupt request signals.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 966 figure 22-7. example of processing in which another interrupt request signal is issued while an interrupt is being serviced (2/2) main routine ei interrupt request i (level 2) servicing of i servicing of k interrupt request j (level 3) servicing of j interrupt request l (level 2) ei ei ei interrupt request o (level 3) interrupt request s (level 1) interrupt request k (level 1) servicing of l servicing of n servicing of m servicing of s servicing of u servicing of t interrupt request m (level 3) interrupt request n (level 1) servicing of o interrupt request p (level 2) interrupt request q (level 1) interrupt request r (level 0) interrupt request u (level 2) note 2 interrupt request t (level 2) note 1 servicing of p servicing of q servicing of r ei if levels 3 to 0 are acknowledged interrupt request j is held pending because its priority is lower than that of i. k that occurs after j is acknowledged because it has the higher priority. interrupt requests m and n are held pending because servicing of l is performed in the interrupt disabled status. pending interrupt requests are acknowledged after servicing of interrupt request l. at this time, interrupt request n is acknowledged first even though m has occurred first because the priority of n is higher than that of m. pending interrupt requests t and u are acknowledged after servicing of s. because the priorities of t and u are the same, u is acknowledged first because it has the higher default priority, regardless of the order in which the interrupt requests have been generated. caution to perform multiple interrupt servicing, the values of the eipc and eipsw registers must be saved before executing the ei instruction. when returning from multiple interrupt servicing, restore the values of eipc and eipsw after executing the di instruction. notes 1. lower default priority 2. higher default priority
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 967 figure 22-8. example of servicing interrupt request signals simu ltaneously generated default priority a > b > c main routine ei interrupt request a (level 2) interrupt request b (level 1) interrupt request c (level 1) servicing of interrupt request b . . servicing of interrupt request c servicing of interrupt request a interrupt request b and c are acknowledged first according to their priorities. because the priorities of b and c are the same, b is acknowledged first according to the default priority. caution to perform multiple interrupt servicing, the values of the eipc and eipsw registers must be saved before executing the ei instruction. when returning from multiple interrupt servicing, restore the values of eipc and eipsw after executing the di instruction. remarks 1. a to c in the figure are the temporary names of interrupt request signals shown for the sake of explanation. 2. the default priority in the figure indicates the relative priority between two interrupt request signals.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 968 22.3.4 interrupt control register (xxicn) the xxicn register is assigned to each interrupt request signal (maskable interrupt) and sets the control conditions for each maskable interrupt request. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 47h. cautions 1. disable interrupts (di) or mask the interrupt to read the xxicn.xxifn bit. if the xxifn bit is read while interrupts are enabled (ei) or while the interrupt is unmasked, the correct value may not be read when acknowledging an inte rrupt and reading the bit conflict. 2. in the v850es/sj2-h, if generation of an interrupt source and a bit manipulation instruction (set1, not1, or clr1 (except tst1)) that mani pulates the xxmkn or xx prn2 to xxprn0 bits of the interrupt source that has been generated conflict, the interrupt request signal may not be generated. this can be avoided in the following two ways. ? when a bit manipulation instruction is not used to the xxicn register <1> change from writing the xxm kn bit to a bit manipulation instruction that manipulates the imrm register. <2> change from writing the xxp rn2 to xxprn0 bits to a byte access to the xxicn register. ? when a bit manipulation instructi on is used to the xxicn register execute a bit manipulation instruction that manipulates the xxicn regi ster after executing a dummy write (byte access) with the unused xxi cn.xxifn bit cleared to 0 in the interrupt disabled (di) status. 3. when manipulating the xxicn.xxmkn bit with the state where an interrupt request can be generated (including an interrupt disable (d i) state), be sure to manipulate with a bit manipulation instruction or by using the imrm.xxmkn bit (m = 0 to 4). in the v850es/sj2-h, however, when using th e bit manipulation instruction, also note with caution the above caution 2.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 969 xxifn interrupt request not issued interrupt request issued xxifn 0 1 interrupt request flag note xxicn xxmkn 0 0 0 xxprn2 xxprn1 xxprn0 interrupt servicing enabled interrupt servicing disabled (pending) xxmkn 0 1 interrupt mask flag specifies level 0 (highest). specifies level 1. specifies level 2. specifies level 3. specifies level 4. specifies level 5. specifies level 6. specifies level 7 (lowest). xxprn2 0 0 0 0 1 1 1 1 interrupt priority specification bit xxprn1 0 0 1 1 0 0 1 1 xxprn0 0 1 0 1 0 1 0 1 after reset: 47h r/w address: fffff112h to fffff1a8h <6> <7> note the flag xxlfn is reset automatically by the hardwa re if an interrupt request signal is acknowledged. remark xx: identification name of each peripheral unit (see table 22-2 interrupt control register (xxicn) ) n: peripheral unit number (see table 22-2 interrupt control register (xxicn) ). the addresses and bits of the interrupt control registers are as follows.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 970 table 22-2. interrupt control register (xxicn) (1/2) bit address register <7> <6> 5 4 3 2 1 0 fffff110h lviic note 1 lviif lvimf 0 0 0 lvipr2 lvipr1 lvipr0 fffff112h pic0 pif0 pmk0 0 0 0 ppr02 ppr01 ppr00 fffff114h pic1 pif1 pmk1 0 0 0 ppr12 ppr11 ppr10 fffff116h pic2 pif2 pmk2 0 0 0 ppr22 ppr21 ppr20 fffff118h pic3 pif3 pmk3 0 0 0 ppr32 ppr31 ppr30 fffff11ah pic4 pif4 pmk4 0 0 0 ppr42 ppr41 ppr40 fffff11ch pic5 pif5 pmk5 0 0 0 ppr52 ppr51 ppr50 fffff11eh pic6 pif6 pmk6 0 0 0 ppr62 ppr61 ppr60 fffff120h pic7 pif7 pmk7 0 0 0 ppr72 ppr71 ppr70 fffff122h tq0ovic tq0ovif tq0ovmk 0 0 0 tq0ovpr2 tq0ovpr1 tq0ovpr0 fffff124h tq0ccic0 tq0ccif0 tq0ccmk0 0 0 0 tq0ccpr02 tq0ccpr01 tq0ccpr00 fffff126h tq0ccic1 tq0ccif1 tq0ccmk1 0 0 0 tq0ccpr12 tq0ccpr11 tq0ccpr10 fffff128h tq0ccic2 tq0ccif2 tq0ccmk2 0 0 0 tq0ccpr22 tq0ccpr21 tq0ccpr20 fffff12ah tq0ccic3 tq0ccif3 tq0ccmk3 0 0 0 tq0ccpr32 tq0ccpr31 tq0ccpr30 fffff12ch tp0ovic tp0ovif tp0ovmk 0 0 0 tp0ovpr2 tp0ovpr1 tp0ovpr0 fffff12eh tp0ccic0 tp0ccif0 tp0ccmk0 0 0 0 tp0ccpr02 tp0ccpr01 tp0ccpr00 fffff130h tp0ccic1 tp0ccif1 tp0ccmk1 0 0 0 tp0ccpr12 tp0ccpr11 tp0ccpr10 fffff132h tp1ovic tp1ovif tp1ovmk 0 0 0 tp1ovpr2 tp1ovpr1 tp1ovpr0 fffff134h tp1ccic0 tp1ccif0 tp1ccmk0 0 0 0 tp1ccpr02 tp1ccpr01 tp1ccpr00 fffff136h tp1ccic1 tp1ccif1 tp1ccmk1 0 0 0 tp1ccpr12 tp1ccpr11 tp1ccpr10 fffff138h tp2ovic tp2ovif tp2ovmk 0 0 0 tp2ovpr2 tp2ovpr1 tp2ovpr0 fffff13ah tp2ccic0 tp2ccif0 tp2ccmk0 0 0 0 tp2ccpr02 tp2ccpr01 tp2ccpr00 fffff13ch tp2ccic1 tp2ccif1 tp2ccmk1 0 0 0 tp2ccpr12 tp2ccpr11 tp2ccpr10 fffff13eh tp3ovic tp3ovif tp3ovmk 0 0 0 tp3ovpr2 tp3ovpr1 tp3ovpr0 fffff140h tp3ccic0 tp3ccif0 tp3ccmk0 0 0 0 tp3ccpr02 tp3ccpr01 tp3ccpr00 fffff142h tp3ccic1 tp3ccif1 tp3ccmk1 0 0 0 tp3ccpr12 tp3ccpr11 tp3ccpr10 fffff144h tp4ovic tp4ovif tp4ovmk 0 0 0 tp4ovpr2 tp4ovpr1 tp4ovpr0 fffff146h tp4ccic0 tp4ccif0 tp4ccmk0 0 0 0 tp4ccpr02 tp4ccpr01 tp4ccpr00 fffff148h tp4ccic1 tp4ccif1 tp4ccmk1 0 0 0 tp4ccpr12 tp4ccpr11 tp4ccpr10 fffff14ah tp5ovic tp5ovif tp5ovmk 0 0 0 tp5ovpr2 tp5ovpr1 tp5ovpr0 fffff14ch tp5ccic0 tp5ccif0 tp5ccmk0 0 0 0 tp5ccpr02 tp5ccpr01 tp5ccpr00 fffff14eh tp5ccic1 tp5ccif1 tp5ccmk1 0 0 0 tp5ccpr12 tp5ccpr11 tp5ccpr10 fffff150h tm0eqic0 tm0eqif0 tm0eqmk0 0 0 0 tm0eqpr02 tm0eqpr01 tm0eqpr00 fffff152h cb0ric/ iicic1 note 2 cb0rif/ iicif1 cb0rmk/ iicmk1 0 0 0 cb0rpr2/ iicpr12 cb0rpr1/ iicpr11 cb0rpr0/ iicpr10 fffff154h cb0tic cb0tif cb0tmk 0 0 0 cb0tpr2 cb0tpr1 cb0tpr0 fffff156h cb1ric cb1rif cb1rmk 0 0 0 cb1rpr2 cb1rpr1 cb1rpr0 fffff158h cb1tic cb1tif cb1tmk 0 0 0 cb1tpr2 cb1tpr1 cb1tpr0 fffff15ah cb2ric cb2rif cb2rmk 0 0 0 cb2rpr2 cb2rpr1 cb2rpr0 fffff15ch cb2tic cb2tif cb2tmk 0 0 0 cb2tpr2 cb2tpr1 cb2tpr0 fffff15eh cb3ric cb3rif cb3rmk 0 0 0 cb3rpr2 cb3rpr1 cb3rpr0 fffff160h cb3tic cb3tif cb3tmk 0 0 0 cb3tpr2 cb3tpr1 cb3tpr0 fffff162h ua0ric/ cb4ric ua0rif/ cb4rif ua0rmk/ cb4rmk 0 0 0 ua0rpr2/ cb4rpr2 ua0rpr1/ cb4rpr1 ua0rpr0/ cb4rpr0 notes 1. v850es/sj2 only 2. i 2 c bus versions (y products) only
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 971 table 22-2. interrupt control register (xxicn) (2/2) bit address register <7> <6> 5 4 3 2 1 0 fffff164h ua0tic/ cb4tic ua0tif/ cb4tif ua0tmk/ cb4tmk 0 0 0 ua0tpr2/ cb4tpr2 ua0tpr1/ cb4tpr1 ua0tpr0/ cb4tpr0 fffff166h ua1ric/ iicic2 note 1 ua1rif/ iicif2 ua1rmk/ iicmk2 0 0 0 ua1rpr2/ iicpr22 ua1rpr1/ iicpr21 ua1rpr0/ iicpr20 fffff168h ua1tic ua1tif ua1tmk 0 0 0 ua1tpr2 ua1tpr1 ua1tpr0 fffff16ah ua2ric/ iicic0 note 1 ua2rif/ iicif0 ua2rmk/ iicmk0 0 0 0 ua2rpr2/ iicpr02 ua2rpr1/ iicpr01 ua2rpr0/ iicpr00 fffff16ch ua2tic ua2tif ua2tmk 0 0 0 ua2tpr2 ua2tpr1 ua2tpr0 fffff16eh adic adif admk 0 0 0 adpr2 adpr1 adpr0 fffff170h dmaic0 dmaif0 dmamk0 0 0 0 dmapr02 dmapr01 dmapr00 fffff172h dmaic1 dmaif1 dmamk1 0 0 0 dmapr12 dmapr11 dmapr10 fffff174h dmaic2 dmaif2 dmamk2 0 0 0 dmapr22 dmapr21 dmapr20 fffff176h dmaic3 dmaif3 dmamk3 0 0 0 dmapr32 dmapr31 dmapr30 fffff178h kric krif krmk 0 0 0 krpr2 krpr1 krpr0 fffff17ah wtiic wtiif wtimk 0 0 0 wtipr2 wtipr1 wtipr0 fffff17ch wtic wtif wtmk 0 0 0 wtpr2 wtpr1 wtpr0 fffff17eh erric0 note 2 / erric note 3 errif0/ errif errmk0/ errmk 0 0 0 errpr02/ errpr2 errpr01/ errpr1 errpr00/ errpr0 fffff180h wupic0 note 2 / staic note 3 wupif0/ staif wupmk0/ stamk 0 0 0 wuppr02/ stapr2 wuppr01/ stapr1 wuppr00/ stapr0 fffff182h recic0 note 2 / ieic1 note 3 recif0/ ieif1 recmk0/ iemk1 0 0 0 recpr02/ iepr12 recpr01/ iepr11 recpr00/ iepr10 fffff184h trxic0 note 2 / ieic2 note 3 trxif0/ ieif2 trxmk0/ iemk2 0 0 0 trxpr02/ iepr22 trxpr01/ iepr21 trxpr00/ iepr20 fffff186h erric1 note 4 errif1 errmk1 0 0 0 errpr12 errpr11 errpr10 fffff188h wupic1 note 4 wupif1 wupmk1 0 0 0 wuppr12 wuppr11 wuppr10 fffff18ah recic1 note 4 recif1 recmk1 0 0 0 recpr12 recpr11 recpr10 fffff18ch trxic1 note 4 trxif1 trxmk1 0 0 0 trxpr12 trxpr11 trxpr10 fffff18eh pic8 pif8 pmk8 0 0 0 ppr82 ppr81 ppr80 fffff190h tp6ovic tp6ovif tp6ovmk 0 0 0 tp6ovpr2 tp6ovpr1 tp6ovpr0 fffff192h tp6ccic0 tp6ccif0 tp6ccmk0 0 0 0 tp6ccp r02 tp6ccpr01 tp6ccpr00 fffff194h tp6ccic1 tp6ccif1 tp6ccmk1 0 0 0 tp6ccp r12 tp6ccpr11 tp6ccpr10 fffff196h tp7ovic tp7ovif tp7ovmk 0 0 0 tp7ovpr2 tp7ovpr1 tp7ovpr0 fffff198h tp7ccic0 tp7ccif0 tp7ccmk0 0 0 0 tp7ccp r02 tp7ccpr01 tp7ccpr00 fffff19ah tp7ccic1 tp7ccif1 tp7ccmk1 0 0 0 tp7ccp r12 tp7ccpr11 tp7ccpr10 fffff19ch tp8ovic tp8ovif tp8ovmk 0 0 0 tp8ovpr2 tp8ovpr1 tp8ovpr0 fffff19eh tp8ccic0 tp8ccif0 tp8ccmk0 0 0 0 tp8ccp r02 tp8ccpr01 tp8ccpr00 fffff1a0h tp8ccic1 tp8ccif1 tp8ccmk1 0 0 0 tp8ccp r12 tp8ccpr11 tp8ccpr10 fffff1a2h cb5ric cb5rif cb5rmk 0 0 0 cb5rpr2 cb5rpr1 cb5rpr0 fffff1a4h cb5tic cb5tif cb5tmk 0 0 0 cb5tpr2 cb5tpr1 cb5tpr0 fffff1a6h ua3ric ua3rif ua3rmk 0 0 0 ua3rpr2 ua3rpr1 ua3rpr0 fffff1a8h ua3tic ua3tif ua3tmk 0 0 0 ua3tpr2 ua3tpr1 ua3tpr0 notes 1. i 2 c bus versions (y products) only 2. can controller versions only 3. iebus controller versions only 4. can controller (2-channel) versions only
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 972 22.3.5 interrupt mask register s 0 to 4 (imr0 to imr4) the imr0 to imr4 registers set the interrupt mask state fo r the maskable interrupts. t he xxmkn bit of the imr0 to imr4 registers is equivalent to the xxicn.xxmkn bit. the imrm register can be read or written in 16-bit units (m = 0 to 4). if the higher 8 bits of the imrm register are used as an imrmh register and the lower 8 bits as an imrml register, these registers can be read or written in 8-bit or 1-bit units (m = 0 to 4). reset sets these registers to ffffh. caution the device file defines the xxi cn.xxmkn bit as a reserved word. if a bit is manipulated using the name of xxmkn, the contents of th e xxicn register, instead of the imrm register, are rewritten (as a result, the contents of the imrm register are also rewritten).
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 973 tp0ccmk0 pmk6 imr0 (imr0h note 1 ) imr0l tp0ovmk pmk5 tq0ccmk3 pmk4 tq0ccmk2 pmk3 tq0ccmk1 pmk2 tq0ccmk0 pmk1 tq0ovmk pmk0 pmk7 lvimk note 2 after reset: ffffh r/w address: imr0 fffff100h, imr0l fffff100h, imr0h fffff101h after reset: ffffh r/w address: imr1 fffff102h, imr1l fffff102h, imr1h fffff103h after reset: ffffh r/w address: imr2 fffff104h, imr2l fffff104h, imr2h fffff105h tp5ccmk1 tp3ovmk imr1 (imr1h note 1 ) imr1l tp5ccmk0 tp2ccmk1 tp5ovmk tp2ccmk0 tp4ccmk1 tp2ovmk tp4ccmk0 tp1ccmk1 tp4ovmk tp1ccmk0 tp3ccmk1 tp1ovmk tp3ccmk0 tp0ccmk1 admk cb3rmk cb3tmk tm0eqmk0 xxmkn 0 1 interrupt servicing enabled interrupt servicing disabled imr2 (imr2h note 1 ) imr2l ua2tmk cb2tmk cb2rmk ua1tmk cb1tmk cb1rmk cb0tmk ua0tmk/ cb4tmk ua2rmk/ iicmk0 ua0rmk/ cb4rmk cb0rmk/ iicmk1 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 0 pmk8 imr3 (imr3h note 1 ) imr3l trxmk1 wtmk recmk1 wtimk wupmk1 krmk errmk1 dmamk3 dmamk2 dmamk1 dmamk0 after reset: ffffh r/w address: imr3 fffff106h, imr3l fffff106h, imr3h fffff107h 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 0 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 0 8 9 10 11 12 13 setting of interrupt mask flag 14 15 1 2 3 4 5 6 7 0 ua1rmk/ iic2mk trxmk0/ iemk2 recmk0/ iemk1 wupmk0/ stamk errmk0/ errmk 1 imr4 (imr4h note 1 ) imr4l 1 tp8ovmk 1 tp7ccmk1 ua3tmk tp7ccmk0 ua3rmk tp7ovmk tp6ccmk1 cb5rmk tp6ccmk0 tp6ovmk after reset: ffffh r/w address: imr4 fffff108h, imr4l fffff108h, imr4h fffff109h 8 tp8ccmk1 9 10 cb5tmk 11 12 13 14 15 1 2 3 4 5 6 7 0 tp8ccmk0 notes 1. to read bits 8 to 15 of the imr0 to imr4 registers in 8-bit or 1-bit units, specify them as bits 0 to 7 of imr0h to imr4h registers. 2. these bits are valid only in the v850es/sj2. be sure to set these bits to 1 in the v850es/sj2-h. caution set bits 13 to 15 of the imr4 register to 1. if the setting of these bits is chan ged, the operation is not guaranteed. remark xx: identification name of each peripheral unit (see table 22-2 interrupt control register (xxicn) ). n: peripheral unit number (see table 22-2 interrupt control register (xxicn) )
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 974 22.3.6 in-service priority register (ispr) the ispr register holds the priority level of the mask able interrupt currently acknowledged. when an interrupt request signal is acknowledged, the bit of this register corresponding to the priori ty level of that interrupt request signal is set to 1 and remains set while the interrupt is serviced. when the reti instruction is executed, the bit correspondi ng to the interrupt request signal having the highest priority is automatically cleared to 0 by hardware. howeve r, it is not cleared to 0 when execution is returned from non- maskable interrupt servicing or exception processing. this register is read-only, in 8-bit or 1-bit units. reset sets this register to 00h. caution if an interrupt is acknowledged while the ispr register is being read in the interrupt enabled (ei) status, the value of the ispr register after the bits of th e register have been set by acknowledging the interrupt may be read. to accu rately read the value of the ispr register before an interrupt is acknowledged, read th e register while interrupts are disabled (di). ispr7 interrupt request signal with priority n not acknowledged interrupt request signal with priority n acknowledged isprn 0 1 priority of interrupt currently acknowledged ispr ispr6 ispr5 ispr4 ispr3 ispr2 ispr1 ispr0 after reset: 00h r address: fffff1fah <7> <6> <5> <4> <3> <2> <1> <0> remark n = 0 to 7 (priority level)
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 975 22.3.7 id flag this flag controls the maskable interr upt?s operating state, and st ores control information regarding enabling or disabling of interrupt request signals. an inte rrupt disable flag (id) is assigned to the psw. reset sets this flag to 00000020h. 0 np ep id sat cy ov s z psw maskable interrupt request signal acknowledgment enabled maskable interrupt request signal acknowledgment disabled (pending) id 0 1 specification of maskable interrupt servicing note after reset: 00000020h note interrupt disable flag (id) function this bit is set to 1 by the di instruction and cleared to 0 by the ei instruction. its value is also modified by the reti instruction or ldsr instru ction when referencing the psw. non-maskable interrupt request signals and exceptions are acknowledged regardless of this flag. when a maskable interrupt request signal is acknowledged, the id flag is automatically set to 1 by hardware. the interrupt request signal generated during the acknowledgment disabled period (id flag = 1) is acknowledged when the xxicn.xxifn bit is set to 1, and the id flag is cleared to 0. 22.3.8 watchdog timer mode register 2 (wdtm2) this register can be read or writt en in 8-bit units (for details, see chapter 11 functions of watchdog timer 2 ). reset sets this register to 67h. 0 wdtm2 wdm21 wdm20 0 0 0 0 0 after reset: 67h r/w address: fffff6d0h stops operation non-maskable interrupt request mode reset mode (initial-value) wdm21 0 0 1 wdm20 0 1 selection of watchdog timer operation mode
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 976 22.4 software exception a software exception is generated when the cpu ex ecutes the trap instruction, and can always be acknowledged. 22.4.1 operation if a software exception occurs, the cpu performs the fo llowing processing, and transfers control to the handler routine. <1> saves the restored pc to eipc. <2> saves the current psw to eipsw. <3> writes an exception code to the lower 16 bits (eicc) of ecr (interrupt source). <4> sets the psw.ep and psw.id bits to 1. <5> sets the handler address (00000040h or 00000050h ) corresponding to the software exception to the pc, and transfers control. figure 22-9 illustrates the proce ssing of a software exception. figure 22-9. software exception processing trap instruction eipc eipsw ecr.eicc psw.ep psw.id pc restored pc psw exception code 1 1 handler address cpu processing exception processing note note trap instruction format: trap vector (t he vector is a value from 00h to 1fh.) the handler address is determined by the trap instruction? s operand (vector). if the vector is 00h to 0fh, it becomes 00000040h, and if the vector is 10h to 1fh, it becomes 00000050h.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 977 22.4.2 restore recovery from software exception processing is carried out by the reti instruction. by executing the reti instruction, t he cpu carries out the following processi ng and shifts control to the restored pc?s address. <1> loads the restored pc and psw from ei pc and eipsw because the psw.ep bit is 1. <2> transfers control to the address of the restored pc and psw. figure 22-10 illustrates the proce ssing of the reti instruction. figure 22-10. reti instruction processing psw.ep reti instruction pc psw eipc eipsw psw.np original processing restored pc psw fepc fepsw 1 1 0 0 caution when the ep and np bits are changed by the ldsr instruction during the software exception processing, in order to restore the pc and psw correctly during recovery by the reti instruction, it is necessary to set the ep bit back to 1 and the np bit back to 0 using the ldsr instruction immediately befo re the reti instruction. remark the solid line shows the cpu processing flow.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 978 22.4.3 ep flag the ep flag is a status flag used to indica te that exception processing is in progress. it is set when an exception occurs. 0 np ep id sat cy ov s z psw exception processing not in progress. exception processing in progress. ep 0 1 exception processing status after reset: 00000020h
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 979 22.5 exception trap an exception trap is an interrupt that is requested when the illegal execution of an instruction takes place. in the v850es/sj2 and v850es/sj2-h, an illegal opcode exception (i lgop: illegal opcode trap) is considered as an exception trap. 22.5.1 illegal opcode definition the illegal instruction has an opcode (bits 10 to 5) of 111111b, a sub-opcode (bits 26 to 23) of 0111b to 1111b, and a sub-opcode (bit 16) of 0b. an exception trap is generated when an instruction applicable to this illegal instruction is executed. 15 16 23 22 0 1 1 1 1 1 1 27 26 31 0 4 5 10 11 1 1 1 1 1 1 0 1 to remark : arbitrary caution since it is possible to assign this instruction to an illegal opcode in the future, it is recommended that it not be used. (1) operation if an exception trap occurs, the cpu performs the follow ing processing, and transfers control to the handler routine. <1> saves the restored pc to dbpc. <2> saves the current psw to dbpsw. <3> sets the psw.np, psw.ep, and psw.id bits to 1. <4> sets the handler address (00000060h) correspondi ng to the exception trap to the pc, and transfers control. figure 22-11 illustrates the processing of the exception trap.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 980 figure 22-11. exception trap processing exception trap (ilgop) occurs dbpc dbpsw psw.np psw.ep psw.id pc restored pc psw 1 1 1 00000060h exception processing cpu processing (2) restore recovery from an exception trap is carried out by the db ret instruction. by executing the dbret instruction, the cpu carries out the following processing and controls the address of the restored pc. <1> loads the restored pc and psw from dbpc and dbpsw. <2> transfers control to the address indicated by the restored pc and psw. caution dbpc and dbpsw can be accessed only durin g the interval between the execution of the illegal opcode and dbret instruction. figure 22-12 illustrates the restore processing from an exception trap. figure 22-12. restore processing from exception trap dbret instruction pc psw dbpc dbpsw jump to address of restored pc
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 981 22.5.2 debug trap a debug trap is an exception that is generated w hen the dbtrap instruction is executed and is always acknowledged. (1) operation upon occurrence of a debug trap, the cpu performs the following processing. <1> saves restored pc to dbpc. <2> saves current psw to dbpsw. <3> sets the psw.np, psw.ep, and psw.id bits to 1. <4> sets handler address (00000060h) for debug trap to pc and transfers control. figure 22-13 shows the debug trap processing format. figure 22-13. debug trap processing format dbtrap instruction dbpc dbpsw psw.np psw.ep psw.id pc restored pc psw 1 1 1 00000060h debug monitor routine processing cpu processing
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 982 (2) restoration restoration from a debug trap is exec uted with the dbret instruction. with the dbret instruction, the cpu performs the follo wing steps and transfers control to the address of the restored pc. <1> the restored pc and psw are read from dbpc and dbpsw. <2> control is transferred to the fetc hed address of the restored pc and psw. caution dbpc and dbpsw can be accessed after the dbtrap instruction is executed and before the dbret instruction is executed. table 22-14 shows the processing format for restoration from a debug trap. figure 22-14. processing format of restoration from debug trap dbret instruction pc psw dbpc dbpsw jump to address of restored pc
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 983 22.6 external interrupt request input pins (nmi and intp0 to intp8) 22.6.1 noise elimination (1) eliminating noise on nmi pin the nmi pin has an internal noise elimination circuit that uses analog delay. therefor e, the input level of the nmi pin is not detected as an edge unless it is maintained for a specific time or longer. therefore, an edge is detected after specific time. the nmi pin can be used to release the stop mode. in the stop mode, noise is not eliminated by using the system clock because the internal system clock is stopped. (2) eliminating noise on intp0 to intp8 pins the intp0 to intp8 pins have an internal noise eliminatio n circuit that uses analog delay. therefore, the input level of the nmi pin is not detected as an edge unless it is maintained for a specific time or longer. therefore, an edge is detected after specific time. 22.6.2 edge detection the valid edge of each of the nmi and intp0 to in tp8 pins can be selected from the following four. ? rising edge ? falling edge ? both rising and falling edges ? no edge detected the edge of the nmi pin is not detected after reset. therefore, the interrupt request signal is not acknowledged unless a valid edge is enabled by using the intf0 and intr0 register (the nmi pin functions as a normal port pin).
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 984 (1) external interrupt fallin g, rising edge specification register 0 (intf0, intr0) the intf0 and intr0 registers are 8-bit registers that specify detection of the falling and rising edges of the nmi pin via bit 2 and the external interrupt pins (intp0 to intp3) via bits 3 to 6. these registers can be read or written in 8-bit or 1-bit units. reset sets these registers to 00h. caution when the function is changed from the extern al interrupt function (alternate function) to the port function, an edge may be detected. there fore, clear the intf0n and intr0n bits to 00, and then set the port mode. 0 intf0 intf06 intp3 intf05 intf04 intf03 intf02 0 0 after reset: 00h r/w address: intf0 fffffc00h, intr0 fffffc20h 0 intr0 intr06 intr05 intr04 intr03 intr02 0 0 intp2 intp1 intp0 nmi intp3 intp2 intp1 intp0 nmi remark for how to specify a valid edge, see table 22-3 . table 22-3. valid edge specification intf0n intr0n valid edge specification (n = 2 to 6) 0 0 no edge detected 0 1 rising edge 1 0 falling edge 1 1 both rising and falling edges caution be sure to clear the intf0 n and intr0n bits to 00 when these registers are not used as the nmi or intp0 to intp3 pins. remark n = 2: control of nmi pin n = 3 to 6: control of intp0 to intp3 pins
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 985 (2) external interrupt fallin g, rising edge specification register 3 (intf3, intr3) the intf3 and intr3 registers are 8-bit registers that specify detection of the falling and rising edges of the external interrupt pin (intp7). these registers can be read or written in 8-bit or 1-bit units. reset sets these registers to 00h. cautions 1. when the function is changed from the external interrupt function (alternate function) to the port function, an edge may be detected. therefore, clear the intf31 and intr31 bits to 00, and then set the port mode. 2. the intp7 pin and rxda0 pin are alternat e-function pins. when using the pin as the rxda0 pin, disable edge detection for th e intp7 alternate-function pin (clear the intf3.intf31 bit and the intr3.intr31 bit to 0) . when using the pin as the intp7 pin, stop uarta0 reception (clear the ua0ctl0.ua0rxe bit to 0). intf3 after reset: 00h r/w address: intf3 fffffc06h, intr3 fffffc26h 0 0 0 0 0 0 intf31 0 intr3 0 0 0 0 0 0 intr31 0 intp7 intp7 remark for how to specify a valid edge, see table 22-4 . table 22-4. valid edge specification intf31 intr31 valid edge specification 0 0 no edge detected 0 1 rising edge 1 0 falling edge 1 1 both rising and falling edges caution be sure to clear the intf31 and intr31 bits to 00 when these re gisters are not used as intp7 pin.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 986 (3) external interrupt fallin g, rising edge specification register 8 (intf8, intr8) the intf8 and intr8 registers are 8-bit registers that specify detection of the falling and rising edges of the external interrupt pin (intp8). these registers can be read or written in 8-bit or 1-bit units. reset sets these registers to 00h. cautions 1. when the function is changed from the external interrupt function (alternate function) to the port function, an edge may be detected. therefore, clear the intf80 and intr80 bits to 00, and then set the port mode. 2. the intp8 pin and rxda3 pin are alternat e-function pins. when using the pin as the rxda3 pin, disable edge detection for th e intp8 alternate-function pin (clear the intf8.intf80 bit and the intr8.intr80 bit to 0) . when using the pin as the intp8 pin, stop uarta3 reception (clear the ua3ctl0.ua3rxe bit to 0). intf8 0 0 0 0 0 0 0 intf80 intr8 0 0 0 0 0 0 0 intr80 intp8 intp8 after reset: 00h r/w address: intf8 fffffc10h, intr8 fffffc30h remark for how to specify a valid edge, see table 22-5 . table 22-5. valid edge specification intf80 intr80 valid edge specification 0 0 no edge detected 0 1 rising edge 1 0 falling edge 1 1 both rising and falling edges caution be sure to clear the intf80 and intr80 bits to 00 when these re gisters are not used as intp8 pin.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 987 (4) external interrupt fallin g, rising edge specification re gisters 9h (intf9h, intr9h) the intf9h and intr9h registers are 8-bit registers that specify detection of the falling and rising edges of the external interrupt pins (intp4 to intp6). these registers can be read or written in 8-bit or 1-bit units. reset sets these registers to 00h. caution when the function is changed from the extern al interrupt function (alternate function) to the port function, an edge may be detected. there fore, clear the intf9n and intr9n bits to 0, and then set the port mode. intf9h after reset: 00h r/w address: intf9h fffffc13h, intr9h fffffc33h intf915 intf914 intf913 0 0 0 0 0 8 9 10 11 12 13 14 15 intr9h intr915 intr914 intr913 0 0 0 0 0 8 9 10 11 12 13 14 15 intp6 intp5 intp4 intp6 intp5 intp4 remark for how to specify a valid edge, see table 22-6 . table 22-6. valid edge specification intf9n intr9n valid edge specification (n = 13 to 15) 0 0 no edge detected 0 1 rising edge 1 0 falling edge 1 1 both rising and falling edges caution be sure to clear the intf9n and intr9n bits to 00 when these re gisters are not used as intp4 to intp6 pins. remark n = 13 to 15: control of intp4 to intp6 pins
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 988 (5) noise elimination control register (nfc) digital noise elimination can be selected for the intp3 pin. the noise elimination settings are performed using the nfc register. when digital noise elimination is selected, the sampling clock for digital sampling can be selected from among f xx /64, f xx /128, f xx /256, f xx /512, f xx /1,024, and f xt . sampling is performed 3 times. when digital noise elimination is selected, if the cloc k that performs sampling in the standby mode is stopped, then the intp3 interrupt request signal cannot be used for releasing the standby mode. when f xt is used as the sampling clock, the intp3 interrupt request signal can be used for releasing either the subclock operating mode or the idle1/idle2/stop/sub-idle mode. this register can be read or written in 8-bit units. reset sets this register to 00h. caution after the sampling clock has been changed, it takes 3 sampling clocks to initialize the digital noise eliminator. therefore, if an intp3 valid edge is input within these 3 sampling clocks after the sampling clock has been changed, an interrupt request signal may be generated. therefore, be careful about the following points when using the interrupt and dma functions. ? when using the interrupt function, after the 3 sampling clocks have elapsed, enable interrupts after the interrupt request flag (pic3.pif3 bit) has been cleared. ? when using the dma function (started by intp3), enable dma after 3 sampling clocks have elapsed. nfen nfc 0 0 0 0 nfc2 nfc1 nfc0 f xx /64 f xx /128 f xx /256 f xx /512 f xx /1,024 f xt (subclock) nfc2 0 0 0 0 1 1 digital sampling clock setting prohibited nfc1 0 0 1 1 0 0 nfc0 0 1 0 1 0 1 after reset: 00h r/w address: fffff318h analog noise elimination (60 ns (typ.)) digital noise elimination nfen 0 1 settings of intp3 pin noise elimination other than above remarks 1. since sampling is performed 3 times, the reliably eliminated noise width is 2 sampling clocks. 2. in the case of noise with a width smaller than 2 sampling clocks, an interrupt request signal is generated if noise synchronized with the sampling clock is input.
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 989 22.7 interrupt acknowledge time of cpu except the following cases, the interrupt acknowledge time of the cpu is 4 clocks minimum. to input interrupt request signals successively, input the next interrupt req uest signal at least 4 clocks after the preceding interrupt. ? in idle1/idle2/stop mode ? when the external bus is accessed ? when interrupt request non-sampling instructions are successively executed (see 22.8 periods in which interrupts are not acknowledged by cpu .) ? when the interrupt control register is accessed ? when an on-chip peripheral i/o register is accessed ? when a programmable peripheral i/o register is accessed
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 990 figure 22-15. pipeline operation at interrupt requ est signal acknowledgment of v850es/sj2 (outline) (1) minimum interrupt response time if id ex ifx idx int2 int3 int4 int1 if id ex wb df 4 system clocks internal system clock instruction 1 instruction 2 interrupt acknowledgment operation first instruction of interrupt servicing routine interrupt acknowledgment (2) maximum interrupt response time if id ex mem mem ifx idx int2 int3 int4 int1 if id ex mem wb int3 int3 6 system clocks internal system clock instruction 1 instruction 2 interrupt acknowledgment operation first instruction of interrupt servicing routine interrupt acknowledgment remarks 1. int1 to int4: interrupt acknowledgment processing ifx: invalid instruction fetch idx: invalid instruction decode 2. if the same interrupt request signal is generated while an interrupt of four cycles is being acknowledged, the new interrupt request signal is discarded. the next interrupt request signal from the same source is registered four cycles later. interrupt response time (internal system clock) internal interrupt external interrupt condition minimum 4 4 + analog delay time maximum 6 6 + analog delay time the following cases are exceptions. ? in idle1/idle2/stop mode ? external bus access ? two or more interrupt request non-sample instructions are executed in succession ? access to interrupt control register ? access to on-chip per ipheral i/o register ? access to programmable peripheral i/o register
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 991 figure 22-16. pipeline operation at interrupt requ est signal acknowledgment of v850es/sj2-h (outline) (1) minimum interrupt response time if id ex ifx idx int2 int3 int4 int1 if id ex wb if df ifx if 4 system clocks internal system clock instruction 1 instruction 2 interrupt acknowledgment operation first instruction of interrupt servicing routine interrupt acknowledgment interleave access (2) maximum interrupt response time if id ex mem mem ifx idx int2 int3 int4 int1 if mem wb int3 int3 mem if ifx int3 if 7 system clocks internal system clock instruction 1 instruction 2 interrupt acknowledgment operation first instruction of interrupt servicing routine interrupt acknowledgment interleave access remarks 1. int1 to int4: interrupt acknowledgment processing ifx: invalid instruction fetch idx: invalid instruction decode 2. if the same interrupt request signal is generated while an interrupt of four cycles is being acknowledged, the new interrupt request signal is discarded. the next interrupt request signal from the same source is registered four cycles later. interrupt response time (internal system clock) internal interrupt external interrupt condition minimum 4 4 + analog delay time maximum 7 7 + analog delay time the following cases are exceptions. ? in idle1/idle2/stop mode ? external bus access ? two or more interrupt request non-sample instructions are executed in succession ? access to interrupt control register ? access to on-chip per ipheral i/o register ? access to programmable peripheral i/o register
chapter 22 interrupt/exception processing function user?s manual u16603ej5v1ud 992 22.8 periods in which interrupts are not acknowledged by cpu an interrupt is acknowledged by the cpu while an instru ction is being executed. however, no interrupt will be acknowledged between an interrupt request non-sample instructi on and the next instruction (int errupt is held pending). the interrupt request non-sample instructions are as follows. ? ei instruction ? di instruction ? ldsr reg2, 0x5 instruction (for psw) ? the store instruction for the prcmd register ? the store, set1, not1, or clr1 inst ructions for the following registers. ? interrupt-related registers: interrupt control register (xxicn), interr upt mask registers 0 to 4 (imr0 to imr4) ? power save control register (psc) ? on-chip debug mode register (ocdm) remark xx: identification name of each peripheral unit (see table 22-2 interrupt control register (xxicn) ) n: peripheral unit number (see table 22-2 interrupt control register (xxicn) ). 22.9 cautions (1) nmi pin the nmi pin and p02 pin are an alternate-function pin, an d function as a normal port pin after being reset. to enable the nmi pin, validate the nmi pi n with the pmc0 register. the initia l setting of the nmi pin is ?no edge detected?. select the nmi pin valid edge using the intf0 and intr0 registers. (2) interrupt control register (xxicn) of v850es/sj2-h in the v850es/sj2-h, if generation of an interrupt source and a bit manipulation instruction (set1, not1, or clr1 (except tst1)) that manipulates the xxmkn or xxpr n2 to xxprn0 bits of the in terrupt source that has been generated conflict, the interrupt request signal may not be generated. this can be avoided in the following two ways. ? when a bit manipulation instruction is not used to the xxicn register <1> change from writing the xxmkn bit to a bit manipulat ion instruction that manipulates the imrm register. <2> change from writing the xxprn2 to xxprn0 bits to a byte access to the xxicn register. ? when a bit manipulation instruction is used to the xxicn register execute a bit manipulation instruction that manipula tes the xxicn register after executing a dummy write (byte access) with the unused xxicn.xxifn bit clear ed to 0 in the interrupt disabled (di) status. (3) interrupt control register (xxi cn) of v850es/sj2 and v850es/sj2-h when manipulating the xxicn.xxmkn bit with the state where an interrupt request can be generated (including an interrupt disable (di) state), be sure to manipulate with a bit manipulation instruction or by using the imrm.xxmkn bit (m = 0 to 4). in the v850es/sj2-h, however, when using the bit mani pulation instruction, also note with caution the above (2). (4) in-service priority register (ispr) if an interrupt is acknowledged while the ispr register is being read in the interrupt enabled (ei) status, the value of the ispr register after the bits of the register have been set by acknowledging the interrupt may be read. to accurately read the value of the ispr register before an interrup t is acknowledged, read the register while interrupts are disabled (di).
user?s manual u16603ej5v1ud 993 chapter 23 key interrupt function 23.1 function a key interrupt request signal (intkr) can be generated by inputting a falling edge to the eight key input pins (kr0 to kr7) by setting the krm register. table 23-1. assignment of key return detection pins flag pin description krm0 controls kr0 signal in 1-bit units krm1 controls kr1 signal in 1-bit units krm2 controls kr2 signal in 1-bit units krm3 controls kr3 signal in 1-bit units krm4 controls kr4 signal in 1-bit units krm5 controls kr5 signal in 1-bit units krm6 controls kr6 signal in 1-bit units krm7 controls kr7 signal in 1-bit units figure 23-1. key re turn block diagram intkr key return mode register (krm) krm7 krm6 krm5 krm4 krm3 krm2 krm1 krm0 kr7 kr6 kr5 kr4 kr3 kr2 kr1 kr0
chapter 23 key interrupt function user?s manual u16603ej5v1ud 994 23.2 register (1) key return mode register (krm) the krm register controls the krm0 to krm7 bits using the kr0 to kr7 signals. this register can be read or writt en in 8-bit or 1-bit units. reset sets this register to 00h. krm7 does not detect key return signal detects key return signal krmn 0 1 control of key return mode krm krm6 krm5 krm4 krm3 krm2 krm1 krm0 after reset: 00h r/w address: fffff300h caution rewrite the krm register after once clearing the krm register to 00h. remark for the alternate-function pin settings, see table 4-19 using port pin as alternate function pin . 23.3 cautions (1) if a low level is input to any of the kr0 to kr7 pins , the intkr signal is not generated even if the falling edge of another pin is input. (2) the rxda1 and kr7 pins must not be used at the same time. to use the rxda1 pin, do not use the kr7 pin. to use the kr7 pin, do not use the rxda1 pin (it is recommended to set the pfc91 bit to 1 and clear pfce91 bit to 0). (3) if the krm register is changed, an interrupt reques t signal (intkr) may be generated. to prevent this, change the krm register after disabling interrupts (di) or masking, then clear the interrupt request flag (kric.krif bit) to 0, and enable interrupts (ei) or clear the mask. (4) to use the key interrupt function, be sure to set the po rt pin to the key return pin and then enable the operation with the krm register. to switch from the key return pin to the port pin, disable the operation with the krm register and then set the port pin.
user?s manual u16603ej5v1ud 995 chapter 24 standby function 24.1 overview the power consumption of the system can be effectively reduced by using the standby modes in combination and selecting the appropriate mode for the application. the available stan dby modes are listed in table 24-1. table 24-1. standby modes mode functional outline halt mode mode in which only the operating clock of the cpu is stopped idle1 mode mode in which all the operations of the internal circuits except the oscillator, pll note , and flash memory are stopped idle2 mode mode in which all the operations of the internal circuits except the oscillator are stopped stop mode mode in which all the operations of the internal circuits except the subclock oscillator are stopped subclock operation mode mode in which the subclock is used as the internal system clock sub-idle mode mode in which all the operations of the internal circuits except the oscillator are stopped, in the subclock operation mode note the pll holds the prev ious operating status.
chapter 24 standby function user?s manual u16603ej5v1ud 996 figure 24-1. status transition reset subclock operation mode (f x operates, pll operates) subclock operation mode (f x stops, pll stops) sub-idle mode (f x operates, pll operates) sub-idle mode (f x stops, pll stops) stop mode (f x stops, pll stops) idle2 mode (f x operates, pll stops) idle1 mode (f x operates, pll operates) idle1 mode (f x operates, pll stops) halt mode (f x operates, pll stops) halt mode (f x operates, pll operates) normal operation mode oscillation stabilization wait clock through mode (pll operates) clock through mode (pll stops) pll mode (pll operates) internal oscillation clock operation wdt overflow oscillation stabilization wait note pll lockup time wait oscillation stabilization wait note oscillation stabilization wait note note if a wdt overflow occurs during an oscillation st abilization time, the cpu operates on the internal oscillation clock. remark f x : main clock oscillation frequency
chapter 24 standby function user?s manual u16603ej5v1ud 997 24.2 registers (1) power save control register (psc) the psc register is an 8-bit register t hat controls the standby function. the stp bit of this register is used to specify the standby mode. this regist er is a special register that can be written only by the special sequence combinations (see 3.4.8 special registers ). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 psc nmi1m nmi0m intm 0 0 stp 0 7 <6> <5> <4> 3 2 <1> 0 after reset: 00h r/w address: fffff1feh standby mode release by intwdt2 signal enabled standby mode release by intwdt2 signal disabled nmi1m 0 1 standby mode release control upon occurrence of intwdt2 signal standby mode release by nmi pin input enabled standby mode release by nmi pin input disabled nmi0m 0 1 standby mode release control by nmi pin input standby mode release by maskable interrupt request signal enabled standby mode release by maskable interrupt request signal disabled intm 0 1 standby mode release control via maskable interrupt request signal normal mode standby mode stp 0 1 standby mode note setting note standby mode set by stp bit: idle1, idle2, stop, or sub-idle mode cautions 1. before setting the idle1, idle2, stop, or sub-idle mode, set the psmr.psm1 and psmr.psm0 bits and then set the stp bit. 2. settings of the nmi1m, nmi0m, and intm bits are invalid when halt mode is released. 3. if the nmi1m, nmi0m, or intm bit is set to 1 at the same time the st p bit is set to 1, the setting of nmi1m, nmi0m, or intm bit beco mes invalid. if there is an unmasked interrupt request signal being held pending when the idle1/idle2/stop mode is set, set the bit corresponding to the interrupt requ est signal (nmi1m, nmi0m, or intm) to 1, and then set the stp bit to 1.
chapter 24 standby function user?s manual u16603ej5v1ud 998 (2) power save mode register (psmr) the psmr register is an 8-bit regist er that controls the operation st atus in the power save mode. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 idle1, sub-idle modes stop mode idle2, sub-idle modes stop mode psm1 0 0 1 1 specification of operation in software standby mode psmr 0 0 0 0 0 psm1 psm0 after reset: 00h r/w address: fffff820h psm0 0 1 0 1 < > < > cautions 1. be sure to cl ear bits 2 to 7 to ?0?. 2. the psm0 and psm1 bits are valid only when the psc.stp bit is 1. remark idle1: in this mode, all operations except the oscillator operation and some other circuits (flash memory and pll) are stopped. after the idle1 mode is released, the nor mal operation mode is restored without needing to secure the oscillation stabilization time, like the halt mode. idle2: in this mode, all operations ex cept the oscillator operation are stopped. after the idle2 mode is released, the normal operation mode is restored following the lapse of the setup time specified by the osts register (flash memory and pll). stop: in this mode, all operations except the subclock oscillator operation are stopped. after the stop mode is released, the norm al operation mode is restored following the lapse of the oscillation stabilization time specified by the osts register. sub-idle: in this mode, all other operations are halted except for the oscillator. after the idle mode has been released by the interrupt r equest signal, the subclock operation mode will be restored after 12 cycles of the subclock have been secured.
chapter 24 standby function user?s manual u16603ej5v1ud 999 (3) oscillation stabilization time select register (osts) the wait time until the oscillation st abilizes after the stop mode is releas ed or the wait time until the on-chip flash memory stabilizes after the idle2 mode is released is controlled by the osts register. the osts register can be read or written 8-bit units. reset sets this register to 06h. 0 osts 0 0 0 0 osts2 osts1 osts0 osts2 0 0 0 0 1 1 1 1 selection of oscillation stabilization time/setup time note osts1 0 0 1 1 0 0 1 1 osts0 0 1 0 1 0 1 0 1 after reset: 06h r/w address: fffff6c0h 2 10 /f x 2 11 /f x 2 12 /f x 2 13 /f x 2 14 /f x 2 15 /f x 2 16 /f x 4 mhz 0.256 ms 0.512 ms 1.024 ms 2.048 ms 4.096 ms 8.192 ms 16.38 ms 5 mhz 0.205 ms 0.410 ms 0.819 ms 1.638 ms 3.277 ms 6.554 ms 13.107 ms f x setting prohibited note the oscillation stabilization time and setup time are required when the stop mode and idle2 mode are released, respectively. cautions 1. the wait time following release of the stop mode does not include the time until the clock oscillation starts (?a? in the figure below) following release of the stop mode, regardless of whether the stop mode is re leased by reset input or the occurrence of an interrupt request signal. a stop mode release voltage waveform of x1 pin v ss 2. be sure to clear bits 3 to 7 to ?0?. 3. the oscillation stabilization time following reset release is 2 16 /f x (because the initial value of the osts register = 06h). remark f x : main clock oscillation frequency
chapter 24 standby function user?s manual u16603ej5v1ud 1000 24.3 halt mode 24.3.1 setting and operation status the halt mode is set when a dedicated instruction (halt) is executed in the normal operation mode. in the halt mode, the clock oscillator continues operating. only clock s upply to the cpu is stopped; clock supply to the other on-chip peripheral functions continues. as a result, program execution is stopped, and the inte rnal ram retains the contents before the halt mode was set. the on-chip peripheral functions that are independent of instruction processing by the cpu continue operating. table 24-3 shows the operating status in the halt mode. the average current consumpt ion of the system can be reduced by usi ng the halt mode in combination with the normal operation mode for intermittent operation. cautions 1. insert five or more nop in structions after the halt instruction. 2. if the halt instruction is executed while an unmasked interrupt request signal is being held pending, the status shifts to halt mode, but th e halt mode is then released immediately by the pending interrupt request. 24.3.2 releasing halt mode the halt mode is released by a non-maskable interrupt request signal (nmi pin input, intwdt2 signal), unmasked external interrupt request signal (intp0 to intp 8 pin input), unmasked internal interrupt request signal from a peripheral function operable in the halt mode, or reset signal (reset pin input, reset signal (wdt2res) generation by overflow of watchdog timer, reset si gnal (lvires) generation by low voltage detector (lvi) note , or reset signal (clmres) generation by clock monitor (clm)). after the halt mode has been released, the normal operation mode is restored. note v850es/sj2 only (1) releasing halt mode by non-m askable interrupt request signal or unmasked maskable interrupt request signal the halt mode is released by a non-maskable interrupt request signal or an unmasked maskable interrupt request signal, regardless of the priority of the interrupt request signal. if the halt mode is set in an interrupt servicing routine, however, an interrupt request si gnal that is issued later is serviced as follows. (a) if an interrupt request signal with a priority lower than that of the interrupt requ est currently being serviced is issued, the halt mode is released, but that interrupt request signal is not acknowledged. the interrupt request signal itself is retained. (b) if an interrupt request signal with a priority higher than that of the interrupt requ est currently being serviced is issued (including a non-maskable interrupt req uest signal), the halt mode is released and that interrupt request signal is acknowledged. table 24-2. operation after releasing halt mode by interrupt request signal release source interrupt enabled (ei) status interrupt disabled (di) status non-maskable interrupt request signal execution branches to the handler address. maskable interrupt request signal execution branches to the handler address or the next instruction is executed. the next instruction is executed.
chapter 24 standby function user?s manual u16603ej5v1ud 1001 (2) releasing halt mode by reset the same operation as the normal reset operation is performed. table 24-3. operating status in halt mode setting of halt mode operating status item when subclock is not used when subclock is used main clock oscillator oscillation enabled subclock oscillator ? oscillation enabled internal oscillator oscillation enabled pll operable cpu stops operation dma operable interrupt controller operable rom correction stops operation timer p (tmp0 to tmp8) operable timer q (tmq0) operable timer m (tmm0) operable when a clock other than f xt is selected as the count clock operable watch timer operable when f x (divided brg) is selected as the count clock operable watchdog timer 2 operable when a clock other than f xt is selected as the count clock operable csib0 to csib5 operable i 2 c00 to i 2 c02 operable serial interface uarta0 to uarta3 operable can controller operable iebus controller operable a/d converter operable d/a converter operable real-time output function (rto) operable key interrupt function (kr) operable crc arithmetic circuit operable (in the status in which data is not input to crcin to stop the cpu) external bus interface see 2.2 pin states . port function retains status before halt mode was set internal data the cpu registers, statuses, data, and all other internal data such as the contents of the internal ram are retained as they were before the halt mode was set.
chapter 24 standby function user?s manual u16603ej5v1ud 1002 24.4 idle1 mode 24.4.1 setting and operation status the idle1 mode is set by clearing the psmr.psm1 and psmr .psm0 bits to 00 and setting the psc.stp bit to 1 in the normal operation mode. in the idle1 mode, the clock oscillator, pll, and flash me mory continue operating but clock supply to the cpu and other on-chip peripheral functions stops. as a result, program execution stops and the contents of the internal ram before the idle1 mode was set are retained. the cpu and other on-chip peripheral functions st op operating. however, the on- chip peripheral functions that can operate with the subclock or an external clock continue operating. table 24-5 shows the operating status in the idle1 mode. the idle1 mode can reduce the power consumption more than the halt mode because it stops the operation of the on-chip peripheral functions. the main clock osc illator does not stop, so t he normal operation mode can be restored without waiting for the oscillation stabilization ti me after the idle1 mode has been released, in the same manner as when the halt mode is released. cautions 1. insert five or more nop instructions after the instruction th at stores data in the psc register to set the idle1 mode. 2. if the idle1 mode is set while an unmasked interrupt request signal is being held pending, the idle1 mode is released immediat ely by the pending interrupt request.
chapter 24 standby function user?s manual u16603ej5v1ud 1003 24.4.2 releasing idle1 mode the idle1 mode is released by a non-maskable interr upt request signal (nmi pin input, intwdt2 signal), unmasked external interrupt request signal (intp0 to intp 8 pin input), unmasked internal interrupt request signal from a peripheral function operable in the idle1 mode, or reset signal (reset pin in put, reset signal (wdt2res) generation by overflow of watchdog timer, reset si gnal (lvires) generation by low voltage detector (lvi) note , or reset signal (clmres) generation by clock monitor (clm)). after the idle1 mode has been released, the normal operation mode is restored. note v850es/sj2 only (1) releasing idle1 mode by non-maskable interr upt request signal or unmasked maskable interrupt request signal the idle1 mode is released by a non-maskable interr upt request signal or an unmasked maskable interrupt request signal, regardless of the priority of the interrupt request signal. if the idle1 mode is set in an interrupt servicing routine, however, an interrupt request si gnal that is issued later is processed as follows. (a) if an interrupt request signal with a priority lower than that of the interrupt requ est currently being serviced is issued, the idle1 mode is rel eased, but that interrupt request si gnal is not acknowledged. the interrupt request signal itself is retained. (b) if an interrupt request signal with a priority higher than that of the interrupt request currently being serviced is issued (including a non-maskable interrupt request signal), the idle1 mode is released and that interrupt request signal is acknowledged. caution an interrupt request signal that is disabled by setting the psc.nmi1m, psc.nmi0m, and psc.intm bits to 1 becomes invalid and idle1 mode is not released. table 24-4. operation after releasing idle1 mode by interrupt request signal release source interrupt enabled (ei) status interrupt disabled (di) status non-maskable interrupt request signal execution branches to the handler address. maskable interrupt request signal execution branches to the handler address or the next instruction is executed. the next instruction is executed.
chapter 24 standby function user?s manual u16603ej5v1ud 1004 (2) releasing idle1 mode by reset the same operation as the normal reset operation is performed. table 24-5. operating status in idle1 mode operating status setting of idle1 mode item when subclock is not used when subclock is used main clock oscillator oscillation enabled subclock oscillator ? oscillation enabled internal oscillator oscillation enabled pll operable cpu stops operation dma stops operation interrupt controller stops operation (but standby mode release enabled) rom correction stops operation timer p (tmp0 to tmp8) stops operation timer q (tmq0) stops operation timer m (tmm0) operable when f r /8 is selected as the count clock operable when f r /8 or f xt is selected as the count clock watch timer operable when f x (divided brg) is selected as the count clock operable watchdog timer 2 operable when f r is selected as the count clock operable when f r or f xt is selected as the count clock csib0 to csib5 operable when the sckbn input cloc k is selected as the count clock (n = 0 to 5) i 2 c00 to i 2 c02 stops operation serial interface uarta0 to uarta3 stops operation (but uarta0 is operable when the ascka0 input clock is selected) can controller stops operation iebus controller stops operation a/d converter holds operation (conversion result held) note d/a converter holds operation (output held note ) real-time output function (rto) stops operation (output held) key interrupt function (kr) operable crc arithmetic circuit stops operation external bus interface see 2.2 pin states . port function retains status before idle1 mode was set internal data the cpu registers, statuses, data, and all other internal data such as the contents of the internal ram are retained as they were before the idle1 mode was set. note to realize low power consumption, stop the a/d converter and d/a converter before shifting to the idle1 mode.
chapter 24 standby function user?s manual u16603ej5v1ud 1005 24.5 idle2 mode 24.5.1 setting and operation status the idle2 mode is set by setting the psmr.psm1 and psmr. psm0 bits to 10 and setting the psc.stp bit to 1 in the normal operation mode. in the idle2 mode, the clock oscillator continues operatio n but clock supply to the cpu, pll, flash memory, and other on-chip peripheral functions stops. as a result, program execution stops and the contents of the internal ram before the idle2 mode was set are retained. the cpu, pll, and other on-chip peripheral functions stop operating. however, the on-chip peripheral functions that can operate with the subclock or an extern al clock continue operating. table 24-7 shows the operating status in the idle2 mode. the idle2 mode can reduce the power consumption more t han the idle1 mode because it stops the operations of the on-chip peripheral functions, pll, and flash memory. however, because the pll and flash memory are stopped, a setup time for the pll and flash memory is required when idle2 mode is released. cautions 1. insert five or more nop instructions after the instruction th at stores data in the psc register to set the idle2 mode. 2. if the idle2 mode is set while an unmasked interrupt request signal is being held pending, the idle2 mode is released immediat ely by the pending interrupt request. 24.5.2 releasing idle2 mode the idle2 mode is released by a non-maskable interr upt request signal (nmi pin input, intwdt2 signal), unmasked external interrupt request signal (intp0 to intp 8 pin input), unmasked internal interrupt request signal from the peripheral functions operable in the idle2 mode, or reset signal (reset pin input, reset signal (wdt2res) generation by overflow of watchdog timer, reset si gnal (lvires) generation by low voltage detector (lvi) note , or reset signal (clmres) generation by clock monitor (clm)). after the idle2 mode has been released, the normal operation mode is restored. note v850es/sj2 only (1) releasing idle2 mode by non-maskable interr upt request signal or unmasked maskable interrupt request signal the idle2 mode is released by a non-maskable interr upt request signal or an unmasked maskable interrupt request signal, regardless of the priority of the interrupt request signal. if the idle2 mode is set in an interrupt servicing routine, however, an interrupt request si gnal that is issued later is processed as follows. (a) if an interrupt request signal with a priority lower than that of the interrupt requ est currently being serviced is issued, the idle2 mode is rel eased, but that interrupt request si gnal is not acknowledged. the interrupt request signal itself is retained. (b) if an interrupt request signal with a priority higher than that of the interrupt request currently being serviced is issued (including a non-maskable interrupt request signal), the idle2 mode is released and that interrupt request signal is acknowledged. caution the interrupt request si gnal that is disabled by setting the psc.nmi1m, psc.nmi0m, and psc.intm bits to 1 becomes invalid and idle2 mode is not released.
chapter 24 standby function user?s manual u16603ej5v1ud 1006 table 24-6. operation after releasing idle2 mode by interrupt request signal release source interrupt enabled (ei) status interrupt disabled (di) status non-maskable interrupt request signal execution branches to the handler address after securing the prescribed setup time. maskable interrupt request signal execution branches to the handler address or the next instruction is executed after securing the prescribed setup time. the next instruction is executed after securing the prescribed setup time. (2) releasing idle2 mode by reset the same operation as the normal reset operation is performed. table 24-7. operating status in idle2 mode operating status setting of idle2 mode item when subclock is not used when subclock is used main clock oscillator oscillation enabled subclock oscillator ? oscillation enabled internal oscillator oscillation enabled pll stops operation cpu stops operation dma stops operation interrupt controller stops operation (but standby mode can be released) rom correction stops operation timer p (tmp0 to tmp8) stops operation timer q (tmp0) stops operation timer m (tmm0) operable when f r /8 is selected as the count clock operable when f r /8 or f xt is selected as the count clock watch timer operable when f x (divided brg) is selected as the count clock operable watchdog timer 2 operable when f r is selected as the count clock operable when f r or f xt is selected as the count clock csib0 to csib5 operable when the sckbn input cloc k is selected as the count clock (n = 0 to 5) i 2 c00 to i 2 c02 stops operation serial interface uarta0 to uarta3 stops operation (but uarta0 is operable when the ascka0 input clock is selected) can controller stops operation iebus controller stops operation a/d converter holds operation (conversion result held) note d/a converter holds operation (output held note ) real-time output function (rto) stops operation (output held) key interrupt function (kr) operable crc arithmetic circuit stops operation external bus interface see 2.2 pin states . port function retains status before idle2 mode was set internal data the cpu registers, statuses, data, and all other internal data such as the contents of the internal ram are retained as they were before the idle2 mode was set. note to realize low power consumption, stop the a/d converter and d/a converter before shifting to the idle2 mode.
chapter 24 standby function user?s manual u16603ej5v1ud 1007 24.5.3 securing setup time when releasing idle2 mode secure the setup time for the rom (f lash memory) after releasing the idle2 mode because the operation of the blocks other than the main clock oscillator stops after the idle2 mode is set. (1) releasing idle2 mode by non-maskable interr upt request signal or unmasked maskable interrupt request signal secure the specified setup time by setting the osts register. when the releasing source is generated, the dedicated in ternal timer starts counting according to the osts register setting. when it overflows, the normal operation mode is restored. oscillated waveform rom circuit stopped setup time count main clock idle mode status interrupt request (2) release by reset (reset pin input, wdt2r es generation) this operation is the same as that of a normal reset. the oscillation stabilization time is the initial value of the osts register, 2 16 /f x .
chapter 24 standby function user?s manual u16603ej5v1ud 1008 24.6 stop mode 24.6.1 setting and operation status the stop mode is set by setting the psmr.psm1 and psmr .psm0 bits to 01 or 11 and setting the psc.stp bit to 1 in the normal operation mode. in the stop mode, the subclock oscillat or continues operating but the main cl ock oscillator stops. clock supply to the cpu and the on-chip peri pheral functions is stopped. as a result, program execution stops , and the contents of the internal ram before the stop mode was set are retained. the on-chip peripheral functi ons that operate with the clock oscillat ed by the subclock oscillator or an external clock continue operating. table 24-9 shows the operating status in the stop mode. because the stop mode stops operation of the main clock oscillator, it reduc es the power consumption to a level lower than the idle2 mode. if the subclock oscillator, inte rnal oscillator, and external clock are not used, the power consumption can be minimized with only leakage current flowing. cautions 1, insert five or more nop instructions after the instruction th at stores data in the psc register to set the stop mode. 2. if the stop mode is set while an unmasked interrupt request signal is being held pending, the stop mode is released immediat ely by the pending interrupt request. 24.6.2 releasing stop mode the stop mode is released by a non-maskable interr upt request signal (nmi pin input, intwdt2 signal), unmasked external interrupt request signal (intp0 to intp 8 pin input), unmasked internal interrupt request signal from the peripheral functions operable in the stop mode, or reset signal (reset pin input, reset signal (wdt2res) generation by overflow of watchdog timer, or reset signal (lvires) generation by low voltage detector (lvi) note ). after the stop mode has been released, the normal operation mode is restor ed after the oscillation stabilization time has been secured. note v850es/sj2 only (1) releasing stop mode by no n-maskable interrupt request signal or unmasked maskable interrupt request signal the stop mode is released by a non-maskable interru pt request signal or an unmasked maskable interrupt request signal, regardless of the priority of the interrupt request signal. if the stop mode is set in an interrupt servicing routine, however, an interrupt request si gnal that is issued later is serviced as follows. (a) if an interrupt request signal with a priority lower than that of the interrupt requ est currently being serviced is issued, the stop mode is released, but that interrupt request signal is not acknowledged. the interrupt request signal itself is retained. (b) if an interrupt request signal with a priority higher than that of the interrupt requ est currently being serviced is issued (including a non-maskable interrupt reques t signal), the stop mode is released and that interrupt request signal is acknowledged. caution the interrupt request that is disabled by setting the psc.nmi1m, psc.nmi0m, and psc.intm bits to 1 becomes invalid a nd stop mode is not released.
chapter 24 standby function user?s manual u16603ej5v1ud 1009 table 24-8. operation after releasing stop mode by interrupt request signal release source interrupt enabled (ei) status interrupt disabled (di) status non-maskable interrupt request signal execution branches to the handler address after securing the oscillation stabilization time. maskable interrupt request signal execution branches to the handler address or the next instruction is executed after securing the oscillation stabilization time. the next instruction is executed after securing the oscillation stabilization time.
chapter 24 standby function user?s manual u16603ej5v1ud 1010 (2) releasing stop mode by reset the same operation as the normal reset operation is performed. table 24-9. operating status in stop mode operating status setting of stop mode item when subclock is not used when subclock is used main clock oscillator stops oscillation subclock oscillator ? oscillation enabled internal oscillator oscillation enabled pll stops operation cpu stops operation dma stops operation interrupt controller stops operation (but standby mode can be released) rom correction stops operation timer p (tmp0 to tmp8) stops operation timer q (tmp0) stops operation timer m (tmm0) operable when f r /8 is selected as the count clock operable when f r /8 or f xt is selected as the count clock watch timer stops operation operable when f xt is selected as the count clock watchdog timer 2 operable when f r is selected as the count clock operable when f r or f xt is selected as the count clock csib0 to csib5 operable when the sckbn input cloc k is selected as the count clock (n = 0 to 5) i 2 c00 to i 2 c02 stops operation serial interface uarta0 to uarta3 stops operation (but uarta0 is operable when the ascka0 input clock is selected) can controller stops operation iebus controller stops operation a/d converter stops operation (conversion result undefined) notes 1, 2 d/a converter stops operation notes 3, 4 (high impedance is output) real-time output function (rto) stops operation (output held) key interrupt function (kr) operable crc arithmetic circuit stops operation external bus interface see 2.2 pin states . port function retains status before stop mode was set internal data the cpu registers, statuses, data, and all other internal data such as the contents of the internal ram are retained as they were before the stop mode was set. notes 1. if the stop mode is set while the a/d converter is operating, the a/d converter is automatically stopped and starts operating again after the stop mode is released. however, in that case, the a/d conversion results after the stop mode is rele ased are invalid. all the a/d conversion results before the stop mode is set are invalid. 2. even if the stop mode is set while the a/d conv erter is operating, the power consumption is reduced equivalently to when the a/d converter is stopped before the stop mode is set. 3. if the stop mode is set while the d/a converter is operating, the d/a converter is automatically stopped and the pin status becomes high impedance. after the stop mode is released, d/a conversion resumes, the setting time elapses, and t he status returns to the output level before the stop mode was set. 4. even if the stop mode is set while the d/a conv erter is operating, the power consumption is reduced equivalently to when the d/a converter is stopped before the stop mode is set.
chapter 24 standby function user?s manual u16603ej5v1ud 1011 24.6.3 securing oscillation stabilizati on time when releasing stop mode secure the oscillation stabilization time for the main clo ck oscillator after releasing the stop mode because the operation of the main clock oscillator stops after stop mode is set. (1) releasing stop mode by non-maskable interrupt request si gnal or unmasked maskable interrupt request signal secure the oscillation stabilization time by setting the osts register. when the releasing source is generated, the dedicated in ternal timer starts counting according to the osts register setting. when it overflows, the normal operation mode is restored. oscillated waveform rom circuit stopped setup time count main clock stop status interrupt request (2) release by reset this operation is the same as that of a normal reset. the oscillation stabilization time is the initial value of the osts register, 2 16 /f x .
chapter 24 standby function user?s manual u16603ej5v1ud 1012 24.7 subclock operation mode 24.7.1 setting and operation status the subclock operation mode is set by setting the pcc.ck3 bit to 1 in the normal operation mode. when the subclock operation mode is set, t he internal system clock is changed from the main clock to the subclock. check whether the clock has been s witched by using the pcc.cls bit. when the pcc.mck bit is set to 1, the operation of the main clock oscillator is stopped. as a result, the system operates only on the subclock. in the subclock operation mode, the power consumption can be reduced to a level lower than in the normal operation mode because the subclock is us ed as the internal system clock. in addition, the power consumption can be further reduced to the level of the stop mode by st opping the operation of t he main clock oscillator. table 24-10 shows the operating st atus in subclock operation mode. cautions 1. when manipulating the ck3 bit, do not ch ange the set values of the pcc.ck2 to pcc.ck0 bits (using a bit manipulation instruction to manipul ate the bit is recommended). for details of the pcc register, see 6.3 (1) pro cessor clock control register (pcc). 2. if the following conditions are not satisfied, ch ange the ck2 to ck0 bits so that the conditions are satisfied and set the subclock operation mode. internal system clock (f clk ) > subclock (f xt = 32.768 khz) 4 remark internal system clock (f clk ): clock generated from the main clock (f xx ) by setting the ck2 to ck0 bits 24.7.2 releasing subc lock operation mode the subclock operation mode is released by a reset signal (reset pin input, reset signal (wdt2res) generation by overflow of watchdog timer, reset signal (l vires) generation by low voltage detector (lvi) note , or reset signal (clmres) generation by clock monitor (clm)) when the ck3 bit is cleared to 0. if the main clock is stopped (mck bit = 1), set the mck bit to 1, secure the oscillation stabilization time of the main clock by software, and clear the ck3 bit to 0. the normal operation mode is restored when the subclock operation mode is released. note v850es/sj2 only caution when manipulating the ck3 bit, do not change the set values of the ck2 to ck0 bits (using a bit manipulation instruction to manipulate the bit is recommended). for details of the pcc register, see 6.3 (1 ) processor clock control register (pcc).
chapter 24 standby function user?s manual u16603ej5v1ud 1013 table 24-10. operating status in subclock operation mode operating status setting of subclock operation mode item when main clock is oscillating when main clock is stopped subclock oscillator oscillation enabled internal oscillator oscillation enabled pll operable stops operation note cpu operable dma operable interrupt controller operable rom correction operable timer p (tmp0 to tmp8) operable stops operation note timer q (tmp0) operable stops operation note timer m (tmm0) operable operable when f r /8 or f xt is selected as the count clock watch timer operable operable when f xt is selected as the count clock watchdog timer 2 operable operable when f r or f xt is selected as the count clock csib0 to csib5 operable operable when the sckbn input clock is selected as the count clock (n = 0 to 5) i 2 c00 to i 2 c02 operable stops operation note serial interface uarta0 to uarta3 operable stops operation (but uarta0 is operable when the ascka0 input clock is selected) can controller operable stops operation note iebus controller operable stops operation note a/d converter operable stops operation note d/a converter operable real-time output function (rto) operable stops operation note (output held) key interrupt function (kr) operable crc arithmetic circuit operable external bus interface operable port function settable internal data settable note to stop the main clock, be sure to stop pll (pllctl.pllon bit = 0). also stop the internal peripheral functions that are operating on the main clock. caution when the cpu is operati ng on the subclock and main cloc k oscillation is stopped, accessing a register in which a wait occurs is disabled. if a wait is generated, it can be released only by reset (see 3.4.9 (2)).
chapter 24 standby function user?s manual u16603ej5v1ud 1014 24.8 sub-idle mode 24.8.1 setting and operation status the sub-idle mode is set by setting the psmr.psm1 a nd psmr.psm0 bits to 00 or 10 and setting the psc.stp bit to 1 in the subclock operation mode. in this mode, the clock oscillator c ontinues operating but clock supply to the cpu, flash memory, and the other on- chip peripheral functions is stopped. as a result, program execution stops and the contents of the internal ram before the sub-idle mode was set are retained. the cpu and the other on-chip peripheral functions are stopped. however, the on-chip peripheral functions that can operate with the subclock or an external clock continue operating. because the sub-idle mode stops oper ation of the cpu, flash memory, and ot her on-chip peripheral functions, it can reduce the power consumption more than the subclock operation mode. if the sub-idle mode is set after the main clock has been stopped, the curr ent consumption can be reduced to a level as low as that in the stop mode. table 24-12 shows the operating status in the sub-idle mode. cautions 1. following the store instruction to the psc register for setting the sub-idle mode, insert the five or more nop instructions. 2. if the sub-idle mode is set while an unmasked interrupt request signal is being held pending, the sub-idle mode is then released immediately by th e pending interrupt request.
chapter 24 standby function user?s manual u16603ej5v1ud 1015 24.8.2 releasing sub-idle mode the sub-idle mode is released by a non-maskable inte rrupt request signal (nmi pin input, intwdt2 signal), unmasked external interrupt request signal (intp0 to intp 8 pin input), unmasked internal interrupt request signal from the peripheral functions operabl e in the sub-idle mode, or reset signal (reset pin input, reset signal (wdt2res) generation by overflow of watchdog timer, re set signal (lvires) generation by low voltage detector (lvi) note or reset signal (clmres) generation by clock monitor (cl m)). the pll returns to t he operating status it was in before the sub-idle mode was set. when the sub-idle mode is released by an interrupt request signal, the subclock operation mode is set. note v850es/sj2 only (1) releasing sub-idle m ode by non-maskable interrupt request signal or unmasked maskable interrupt request signal the sub-idle mode is released by a non-maskable interrupt request signal or an unmasked maskable interrupt request signal, regardless of the pr iority of the interrupt request signal. if the sub-idle mode is set in an inte rrupt servicing routine, however, an in terrupt request signal that is issued later is serviced as follows. (a) if an interrupt request signal with a priority lower t han that of the interrupt r equest currently being serviced is issued, the sub-idle mode is released, but that interrupt request signal is not acknowledged. the interrupt request signal itself is retained. (b) if an interrupt request signal with a priority higher than that of the interrupt reques t currently being serviced is issued (including a non-maskable interrupt request signal), the sub-idle mode is released and that interrupt request signal is acknowledged. cautions 1. the interrupt request signal that is disabled by setting the psc.nmi1m, psc.nmi0m, and psc.intm bits to 1 becomes invalid and sub-idle mode is not released. 2. when the sub-idle mode is relea sed, 12 cycles of the subclock (about 366 s) elapse from when the interrupt request signal that releases the sub-idle mode is generated to when the mode is released. table 24-11. operation after releasing sub- idle mode by interrupt request signal release source interrupt enabled (ei) status interrupt disabled (di) status non-maskable interrupt request signal execution branches to the handler address. maskable interrupt request signal execution branches to the handler address or the next instruction is executed. the next instruction is executed.
chapter 24 standby function user?s manual u16603ej5v1ud 1016 (2) releasing sub-id le mode by reset the same operation as the normal reset operation is performed. table 24-12. operating status in sub-idle mode operating status setting of sub-idle mode item when main clock is oscillating when main clock is stopped subclock oscillator oscillation enabled internal oscillator oscillation enabled pll operable stops operation note 1 cpu stops operation dma stops operation interrupt controller stops operation (but standby mode can be released) rom correction stops operation timer p (tmp0 to tmp8) stops operation timer q (tmp0) stops operation timer m (tmm0) operable when f r /8 or f xt is selected as the count clock watch timer stops operation operable when f xt is selected as the count clock watchdog timer 2 operable when f r or f xt is selected as the count clock csib0 to csib5 operable when the sckbn input cloc k is selected as the count clock (n = 0 to 5) i 2 c00 to i 2 c02 stops operation serial interface uarta0 to uarta3 stops operation (but uarta0 is operable when the ascka0 input clock is selected) can controller stops operation iebus controller stops operation a/d converter holds operation (conversion result held) note 2 d/a converter holds operation (output held note 2 ) real-time output function (rto) stops operation (output held) key interrupt function (kr) operable crc arithmetic circuit stops operation external bus interface see 2.2 pin states (same operation status as idle1, idle2 mode). port function retains status before sub-idle mode was set internal data the cpu registers, statuses, data, and all other internal data such as the contents of the internal ram are retained as they were before the sub-idle mode was set. notes 1. be sure to stop the pll (pllctl.pllon bit = 0) before stopping the main clock. 2. to realize low power consumption, stop the a/d and d/a converters before shifting to the sub-idle mode.
user?s manual u16603ej5v1ud 1017 chapter 25 reset functions 25.1 overview the following reset functions are available. (1) reset sources ? external reset input via the reset pin ? reset via the watchdog timer 2 (wdt2) overflow (wdt2res) ? system reset via the comparison of the low-voltage detector (lvi) su pply voltage and detected voltage (lvires) note ? system reset via the detecting clock monitor (clm) oscillation stop (clmres) note v850es/sj2 only after a reset is released, the source of the reset can be confirmed with the reset source flag register (resf).
chapter 25 reset functions user?s manual u16603ej5v1ud 1018 (2) emergency operation mode if the wdt2 overflows during the main clock oscillation stabilization time inserted after reset release or stop mode release, a main clock oscillation anomaly is j udged and the cpu starts operating on the internal oscillation clock. caution when the cpu operates on th e internal oscillation clock, acce ss to the register in which a wait state is generated is prohibi ted. for the register in which a wait state is generated, see 3.4.9 (2) accessing specific on-ch ip peripheral i/o registers. figure 25-1. block di agram of reset function (a) v850es/sj2 clmrf lvirf wdt2rf reset source flag register (resf) internal bus wdt2 reset signal clm reset signal reset lvi reset signal reset signal reset signal reset signal to lvim/lvis register clear set set clear clear set caution an lvi circuit internal r eset does not reset the lvi circuit. remarks 1. lvim: low-voltage detection register 2. lvis: low-voltage detection level selection register (b) v850es/sj2-h clmrf wdt2rf reset source flag register (resf) internal bus wdt2 reset signal clm reset signal reset reset signal reset signal clear set clear set
chapter 25 reset functions user?s manual u16603ej5v1ud 1019 25.2 registers to check reset source the v850es/sj2 has four kinds of rese t sources, and the v850es/sj2-h has thr ee kinds of reset sources. after a reset has been released, the source of the reset that oc curred can be checked with the reset source flag register (resf). (1) reset source flag register (resf) the resf register is a special regi ster that can be written only by a co mbination of specific sequences (see 3.4.8 special registers ). the resf register indicates the source from which a reset signal is generated. this register is read or written in 8-bit or 1-bit units. reset pin sets this register to 00h. the default value di ffers if the source of rese t is other than the reset pin signal. 0 wdt2rf 0 1 not generated generated resf 0 0 wdt2rf 0 0 clmrf lvirf note 2 after reset: 00h note 1 r/w address: fffff888h reset signal from wdt2 lvirf note 2 0 1 not generated generated reset signal from lvi clmrf 0 1 not generated generated reset signal from clm notes 1. the value of the resf register is cleared to 00h when a reset is executed via the reset pin. when a reset is executed by the watchdog timer 2 (wdt2), clock monitor (clm), or low-voltage detector (lvi), the reset flag of that register (wdt2rf, clmrf, or lvirf bit) is set; however, other sources are retained. 2. that lvirf bit is available only in the v850es/sj2. be sure to set bit 0 to ?0? in the v850es/sj2-h. caution only ?0? can be written to each bit of this register. if writing ?0? conflicts with setting the flag (occurrence of reset), se tting the flag takes precedence.
chapter 25 reset functions user?s manual u16603ej5v1ud 1020 25.3 operation 25.3.1 reset operation via reset pin when a low level is input to the reset pin, the syst em is reset, and each hardware unit is initialized. when the level of the reset pin is changed from low to high, the reset status is released. table 25-1. hardware status on reset pin input item during reset after reset main clock oscillator (f x ) oscillation stops oscillation starts subclock oscillator (f xt ) oscillation continues internal oscillator oscillation stops oscillation starts peripheral clock (f xx to f xx /1,024) operation stops operation starts after securing oscillation stabilization time internal system clock (f clk ), cpu clock (f cpu ) operation stops operation starts after securing oscillation stabilization time (initialized to f xx /8) cpu initialized program execution starts after securing oscillation stabilization time watchdog timer 2 operation stops (initialized to 0) counts up from 0 with internal oscillation clock as source clock. internal ram undefined if power-on reset or cpu acce ss and reset input conflict (data is damaged). otherwise value imm ediately after reset input is retained note 1 . i/o lines (ports/alternate-function pins) high impedance note 2 on-chip peripheral i/o registers initialized to sp ecified status, ocdm register is set (01h). other on-chip peripheral functions operation st ops operation can be started after securing oscillation stabilization time notes 1. the firmware of the v850es/sj2 and v850es/sj2-h use part of the internal ram after the internal system reset operation has been released, because they support a boot swap function. therefore, the contents of some ram areas are not reta ined on power-on reset. for details, see 25.3.5 operation after reset release . 2. when the power is turned on, the following pins may momentarily output an undefined level. ? p10/ano0 pin ? p11/ano1 pin ? p53/sib2/kr3/tiq00/toq00/rtp 03/ddo pin (the ddo pin is provided only in the flash memory version) caution the ocdm register is initialized by the reset pin input. therefore, note with caution that, if a high level is input to the p05/drst pin after a reset release before the ocdm.ocdm0 bit is cleared, the v850es/sj2 may enter on-chip debug mode (flash memory versions only). the mask rom versions do not support the on-chip debug mo de; however the ocdm register controls the pull-down resistor connected to the p05/intp2 pin. for details, see chapter 4 port functions.
chapter 25 reset functions user?s manual u16603ej5v1ud 1021 figure 25-2. timing of reset operation by reset pin input counting of oscillation stabilization time initialized to f xx /8 operation oscillation stabilization timer overflows internal system reset signal analog delay (eliminated as noise) analog delay analog delay (eliminated as noise) reset f x f clk analog delay figure 25-3. timing of power-on reset operation oscillation stabilization time count must be on-chip regulator stabilization time (1 ms (max.)) or longer. initialized to f xx /8 operation overflow of timer for oscillation stabilization internal system reset signal reset f x v dd f clk analog delay
chapter 25 reset functions user?s manual u16603ej5v1ud 1022 25.3.2 reset operation by watchdog timer 2 (wdt2res) when watchdog timer 2 is set to the reset operation mode due to overflow, upon watchdog timer 2 overflow (wdt2res signal generati on), a system reset is executed and the hardware is initialized to the initial status. following watchdog timer 2 overflow, the reset status is entered and lasts the predetermined time (analog delay), and the reset status is then automatically released. the main clock oscillator is stopped during the reset period. table 25-2. hardware status duri ng watchdog timer 2 reset operation item during reset after reset main clock oscillator (f x ) oscillation stops oscillation starts subclock oscillator (f xt ) oscillation continues internal oscillator oscillation stops oscillation starts peripheral clock (f xx to f xx /1,024) operation stops operation starts after securing oscillation stabilization time internal system clock (f clk ), cpu clock (f cpu ) operation stops operation starts after securing oscillation stabilization time (initialized to f xx /8) cpu initialized program execution after securing oscillation stabilization time watchdog timer 2 operation stops (initialized to 0) counts up from 0 with internal oscillation clock as source clock. internal ram undefined if power-on reset or cpu ac cess and reset input conflict (data is damaged). otherwise value imm ediately after reset input is retained note . i/o lines (ports/alternate-function pins) high impedance on-chip peripheral i/o register initialized to spec ified status, ocdm register retains its value. on-chip peripheral functions other than above operation stops operation can be started after securing oscillation stabilization time. note the firmware of the v850es/sj2 and v850es/sj2-h uses part of the inte rnal ram after the internal system reset operation has been released because it supports a boot swap function. t herefore, the contents of some ram areas are not retained on power-on reset. for details, see 25.3.5 operation after reset release .
chapter 25 reset functions user?s manual u16603ej5v1ud 1023 figure 25-4. timing of reset oper ation by wdt2res signal generation counting of oscillation stabilization time initialized to f xx /8 operation oscillation stabilization timer overflow internal system reset signal wdt2res f x f clk analog delay
chapter 25 reset functions user?s manual u16603ej5v1ud 1024 25.3.3 reset operation by low-voltage detector (lvires) (v850es/sj2 only) if the supply voltage falls below the vo ltage detected by the low-voltage detector when lvi operation is enabled, a system reset is executed (when the lvim.lvimd bit is set to 1), and the hardware is initia lized to the initial status. the reset status lasts from when a supply voltage drop has been detected until the su pply voltage rises above the lvi detection voltage. the main clock oscillator is stopped during the reset period. when the lvimd bit = 0, an interrupt request signal (i ntlvi) is generated if a low voltage is detected. table 25-3. hardware status during reset operation by low-voltage detector item during reset after reset main clock oscillator (f x ) oscillation stops oscillation starts subclock oscillator (f xt ) oscillation continues internal oscillator oscillation stops oscillation starts peripheral clock (f xx to f xx /1,024) operation stops operation starts after securing oscillation stabilization time internal system clock (f clk ), cpu clock (f cpu ) operation stops operation starts after securing oscillation stabilization time (initialized to f xx /8) cpu initialized program execution starts after securing oscillation stabilization time wdt2 operation stops (initialized to 0) counts up from 0 with internal oscillation clock as source clock. internal ram undefined if power-on reset or cpu ac cess and reset input conflict (data is damaged). otherwise value imm ediately after reset input is retained note . i/o lines (ports/alternate-function pins) high impedance on-chip peripheral i/o register initialized to spec ified status, ocdm register retains its value. lvi operation continues on-chip peripheral functions other than above operation stops operation can be started after securing oscillation stabilization time. note the firmware of the v850es/sj2 uses part of the internal ram after t he internal system reset operation has been released because it supports a boot swap function . therefore, the content s of some ram areas are not retained on power-on reset. for details, see 25.3.5 operation after reset release . remark the reset timing of the low-voltage detector, see chapter 27 low-voltage detector .
chapter 25 reset functions user?s manual u16603ej5v1ud 1025 25.3.4 reset operation by clock monitor (clmres) when the clock monitor operation is enabled, the main cl ock is monitored by using the sampling clock (internally oscillated clock: f r ). if it is detected that the main clock is st opped, the system is reset and each hardware unit is initialized to a specific status. after it has been detected that the main clock is stopped, the cpu is placed in the reset status for a specific time (of analog delay), and then it is automatica lly released from the reset status. af ter the reset status has been released, the timer for oscillation stabilization does not perform it s counting operation, because the main clock is stopped. when watchdog timer 2 that is started by default overfl ows, the cpu starts program execution on an internally oscillated clock (f r ). the status of each hardware unit during the reset period executed by the reset signal (clmres) of the clock monitor operation and after the reset status is released is shown below. for the reset timing by the clock monitor operation, see figure 25-5 . table 25-4. hardware status during reset operation by clock monitor item during reset after reset main clock oscillator (f x ) oscillation stops oscillation starts note subclock oscillator (f xt ) oscillation continues internal oscillator oscillation stops oscillation starts peripheral clock (f xx to f xx /1,024) operation stops operation starts after securing oscillation stabilization time note . internal system clock (f clk ), cpu clock (f cpu ) operation stops operation starts after securing oscillation stabilization time (initialized to f xx /8). however, if watchdog timer 2 overflows before the cpu execution, operation starts with the internal oscillation clock (f r ). cpu initialized program execution starts after securing oscillation stabilization time. however, if watchdog timer 2 overflows before the cpu execution, operation starts with the internal oscillation clock (f r ). wdt2 operation stops (initialized to 0) operation starts. wdt2res is not generated, however, if only watchdog timer 2 overflows before cpu execution. internal ram undefined i/o lines (ports/alternate- function pins) high impedance on-chip peripheral i/o register initialized to spec ified status, ocdm register retains its value. on-chip peripheral functions other than above operation stops operation can be started after securing oscillation stabilization time note . note when the main clock starts oscillation after the reset operation by the clock monitor. remark for details of the clock monitor, see chapter 26 clock monitor .
chapter 25 reset functions user?s manual u16603ej5v1ud 1026 figure 25-5. reset timing by clock monitor count operation or count stop f x f clk f r clmres wdt2 count clm.clme bit resf.clmrf bit count operation continue stop count operation f r operation keep oscillation stabilization time (count operation stop) main clock operation stop watchdog timer 2 overflow (wdt2res not occur) watchdog timer 2 count operation start main clock stop detection program fetch start remark the mode cannot be restored by software to th e normal operation mode from the internally oscillated clock operation mode. the normal oper ation mode can be restored only when the main clock oscillation (f x ) operates normally after reset (generation of reset, wdt2res, or lvires (v850es/sj2 only) signals).
chapter 25 reset functions user?s manual u16603ej5v1ud 1027 25.3.5 operation after reset release after the reset is released, the main clock starts oscillati on and oscillation stabilization time (osts register initial value: 2 16 /f x ) is secured, and the cpu st arts program execution. wdt2 immediately begins to operate after a reset has been released using the internal oscillation clock as a source clock. figure 25-6. operation after reset release main clock reset counting of oscillation stabilization time normal operation (f cpu = main clock) operation stops operation in progress operation stops operation in progress clock monitor internal oscillation clock v850es/sj2, v850es/sj2-h wdt2 (1) emergent operation mode if an anomaly occurs in the main clock before oscillatio n stabilization time is secured, the wdt2 overflows before executing the cpu program. at this time, the cpu starts program execution by using the internal oscillation clock as the source clock. figure 25-7. operation after reset release main clock reset counting of oscillation stabilization time wdt overflows emergency mode (f cpu = internal oscillation clock) operation stops operation in progress operation in progress (re-count) operation stops clock monitor internal oscillation clock v850es/sj2, v850es/sj2-h wdt2 the cpu operation clock states c an be checked with the cpu operation clock status register (ccls).
chapter 25 reset functions user?s manual u16603ej5v1ud 1028 (2) firmware operation (flash memory version only) in the flash memory version, after a reset is released, the on-chip firmware operates before starting the user program to support the boot switch function. reset oscillation stabilization time user program operation start firmware operation v850es/sj2: firmware operation time: 14,974 (1/f x ) (sec.) v850es/sj2-h: firmware operation time: 11,994 (1/f x ) (sec.) caution to accurately start the user program opera tion, fix the flmd0 pin to the low level, since the reset status has been re leased until the stabilization oscillation time elapses and the firmware operation has been completed. remark f x : main clock oscillation frequency (mhz) since the firmware uses a portion of the internal ra m, the contents of the fo llowing ram areas are not retained through a reset even in power on status. ? version with 32 kb ram: 03ff7000h to 03ff7095h, 03ffefbah to 03ffefffh ? version with 48 kb ram: 03ff3000h to 03ff3095h, 03ffefbah to 03ffefffh (a) version with 32 kb ram (b) version with 48 kb ram ram retention disabled area (150 bytes) ram retention disabled area (70 bytes) ram retention enabled area 32 kb ram retention disabled area (150 bytes) ram retention disabled area (70 bytes) ram retention enabled area 48 kb 03ffefffh 03ffefbah 03ffefb9h 03ff7096h 03ff7095h 03ff7000h 03ffefffh 03ffefbah 03ffefb9h 03ff3096h 03ff3095h 03ff3000h
chapter 25 reset functions user?s manual u16603ej5v1ud 1029 25.3.6 reset function operation flow (1/2) start (reset source generated) main clock oscillation stabilization time secured? no ccls.cclsf bit = 1? yes no (in normal operation mode) no (in emergent operation mode) reset source generated? yes no yes (in normal operation mode) wdt2 overflow? no yes (in emergent operation mode) set resf register note 1 reset occurs reset release firmware operation note 3 emergent operation software processing normal operation cpu operation starts from reset address (f cpu = f x /8, f r ) f cpu = f x f cpu = f r note 2 ccls.cclsf bit 1 wdt2 restart internal oscillation and main clock oscillation start, wdt2 count up starts (reset mode)
chapter 25 reset functions user?s manual u16603ej5v1ud 1030 (2/2) notes 1. bit to be set differs depending on the reset source. reset source wdt2rf bit clmrf bit lvirf bit (v850es/sj2 only) reset pin 0 0 0 wdt2 1 value before reset is retained. value before reset is retained. clm value before reset is retained. 1 value before reset is retained. lv i (v850es/sj2 only) value before reset is retained. value before reset is retained. 1 2. the internal oscillator cannot be stopped. 3. flash memory version only. 25.4 valid/invalid of internal ram data (1) internal ram data status register (rams) the rams register is a special register. this can be written only in a special combination of sequences (see 3.4.8 special registers ). this register is a flag register that indica tes whether the internal ram is valid or not. this register can be read or written in 8-bit or 1-bit units. the set/clear conditions for the ramf bit are shown below. ? setting conditions: detection of voltage lower than specified level set by instruction generation of reset signal by wdt2 and clm generation of reset signal while ram is being accessed generation of reset signal via the reset pin while internal ram is being accessed. ? clearing condition: writing of 0 in specific sequence after reset: 01h note r/w address: fffff892h 7 6 5 4 3 2 1 <0> rams 0 0 0 0 0 0 0 ramf ramf internal ram data valid/invalid 0 valid 1 invalid note this register is set to 01h after reset by the reset pin input (only for ram access), watchdog timer 2 overflow, or clock monitor. after reset by other sources, the register va lue at that time will be retained.
user?s manual u16603ej5v1ud 1031 chapter 26 clock monitor 26.1 functions the clock monitor samples the main clock by using the internal oscillation clock and generates a reset request signal (clmres) when oscillation of the main clock is stopped. once the operation of the clock monitor has been enabled by an operation enable flag, it cannot be cleared to 0 by any means other than reset. when a reset (clmres) by the clock monitor occurs, the resf .clmrf bit is set. for details on the resf register, see 25.2 registers to check reset source . the clock monitor automatically stops under the following conditions. ? during oscillation stabilization time after stop mode is released ? when the main clock is stopped (from when the pcc.mck bit = 1 during subclock operation, until the pcc.cls bit = 0 during main clock operation) ? when the sampling clock (internal oscillation clock) is stopped ? when the cpu operates with the internal oscillation clock 26.2 configuration the clock monitor consists of the following hardware. table 26-1. configuration of clock monitor item configuration control register clock monitor mode register (clm) figure 26-1. timing of reset via clock monitor main clock internal oscillation clock internal reset signal (clmres) enable/disable clme clock monitor mode register (clm)
chapter 26 clock monitor user?s manual u16603ej5v1ud 1032 26.3 register the clock monitor is controlled by the clock monitor mode register (clm). (1) clock monitor mode register (clm) the clm register is a special regist er. this can be written only in a s pecial combination of sequences (see 3.4.8 special registers ). this register is used to set the operation mode of the clock monitor. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. after reset: 00h r/w address: fffff870h 7 6 5 4 3 2 1 <0> clm 0 0 0 0 0 0 0 clme clme clock monitor operation enable or disable 0 disable clock monitor operation. 1 enable clock monitor operation. cautions 1. once the clme bit has been set to 1, it cannot be clear ed to 0 by any means other than reset. 2. when a reset by the clock monitor occu rs, the clme bit is cleared to 0 and the resf.clmrf bit is set to 1.
chapter 26 clock monitor user?s manual u16603ej5v1ud 1033 26.4 operation this section explains the functions of the clock m onitor. the start and stop conditions are as follows. enabling operation by setting the clm.clme bit to 1 ? while oscillation stabilization time is being counted after stop mode is released ? when the main clock is stopped (from when pcc.mck bit = 1 during subclock operation to when pcc.cls bit = 0 during main clock operation) ? when the sampling clock (internal oscillation clock) is stopped ? when the cpu operates with the internal oscillation clock table 26-2. operation status of clock monitor (when clm.clme bit = 1, during inte rnal oscillation clock operation) cpu operating clock operation mode status of main clock status of internal oscillation clock status of clock monitor halt mode oscillates oscillates note 1 operates note 2 idle1, idle2 modes oscillates oscillates note 1 operates note 2 main clock stop mode stops oscillates note 1 stops subclock (pcc.mck bit = 0) sub-idle mode oscillates oscillates note 1 operates note 2 subclock (pcc.mck bit = 1) sub-idle mode stops oscillates note 1 stops internal oscillation clock ? stops oscillates note 3 stops during reset ? stops stops stops notes 1. internal oscillator can be stopped by setting the rcm.rstop bit to 1. 2. the clock monitor is stopped while internal oscillator is stopped. 3. internal oscillator cannot be stopped by software.
chapter 26 clock monitor user?s manual u16603ej5v1ud 1034 (1) operation when main clock osc illation is stopped (clme bit = 1) if oscillation of the main clock is stopped when the clme bit = 1, an internal reset signal (clmres) is generated as shown in figure 26-2. figure 26-2. reset period due to that oscillation of main clock is stopped four internal oscillation clocks main clock internal oscillation clock clmres clm.clme bit resf.clmrf bit (2) clock monitor status after reset input reset input clears the clm.clme bit to 0 and stops the cl ock monitor operation. when clme bit is set to 1 by software at the end of the oscillation stabilization time of the main clock, monitoring is started. figure 26-3. clock monitor status after reset input (clm.clme bit = 1 is set after reset input and at the end of main clock oscillation stabilization time) cpu operation clock monitor status clme bit reset internal oscillation clock main clock reset oscillation stabilization time normal operation clock supply stopped normal operation monitoring monitoring stopped monitoring set to 1 by software
chapter 26 clock monitor user?s manual u16603ej5v1ud 1035 (3) operation in stop mode or after stop mode is released if the stop mode is set with the clm.clme bit = 1, the monitor operation is stopped in the stop mode and while the oscillation stabilization ti me is being counted. after the osc illation stabilization time, the monitor operation is automatically started. figure 26-4. operation in stop mode or after stop mode is released clock monitor status during monitor monitor stops during monitor clme bit internal oscillation clock main clock cpu operation normal operation stop oscillation stabilization time normal operation oscillation stops oscillation stabilization time (set by osts register) (4) operation when main clock is stopped (arbitrary) during subclock operation (pcc.cls bit = 1) or when the main clock is stopped by setting the pcc.mck bit to 1, the monitor operation is stopped until the main cloc k operation is started (pcc.cls bit = 0). the monitor operation is automatically started when the main clock operation is started. figure 26-5. operation when main clock is stopped (arbitrary) clock monitor status during monitor monitor stops monitor stops during monitor clme bit internal oscillation clock main clock cpu operation oscillation stops subclock operation main clock operation oscillation stabilization time (set by osts register) oscillation stabilization time count by software pcc.mck bit = 1 (5) operation while cpu is operating on inte rnal oscillation clock (ccls.cclsf bit = 1) the monitor operation is not stopped when the cclsf bi t is 1, even if the clme bit is set to 1.
user?s manual u16603ej5v1ud 1036 chapter 27 low-voltage detector low-voltage detector (lvi) is pr ovided only to the v850es/sj2. ram retention voltage detection operation and emulation f unction are provided to both the v850es/sj2 and v850es/sj2-h. 27.1 functions the low-voltage detector (lvi) has the following functions. ? compares the supply voltage (v dd ) and detected voltage (v lv i ) and generates an internal interrupt signal or internal reset signal (lvires) when v dd < v lv i . ? the level of the supply voltage to be detecte d can be changed by software (in two steps). ? interrupt or reset signal c an be selected by software. if the low-voltage detector is used to generate a reset signal, the resf.lvirf bit is set to 1 when the lvires signal is generated. for details of the resf register, see chapter 25 reset function . 27.2 configuration figure 27-1 shows the block diagram of the low-voltage detector. figure 27-1. block diagram of low-voltage detector lvis0 lvion detected voltage source (v lvi ) v dd v dd intlvi internal bus n-ch low voltage detection level selection register (lvis) low voltage detection register (lvim) lvimd lvif internal reset signal (lvires) selector low voltage detection level selector ? +
chapter 27 low-voltage detector user?s manual u16603ej5v1ud 1037 27.3 registers the low-voltage detector is contro lled by the following registers. ? low voltage detection register (lvim) ? low voltage detection level selection register (lvis) (1) low voltage detection register (lvim) the lvim register is a special register. this can be written only in the special combination of the sequences (see 3.4.8 special register ). the lvim register is used to enable or disable low volt age detection, and to set the operation mode of the low- voltage detector. this register can be read or written in 8-bit or 1- bit units. however, the lvif bit is read-only. after reset: note 1 r/w address: fffff890h <7> 6 5 4 3 2 <1> <0> lvim lvion 0 0 0 0 0 lvimd lvif lvion low voltage detection operation enable or disable 0 disable operation. 1 enable operation. lvimd selection of operation mode of low voltage detection 0 generate interrupt request signal (intlvi) when supply voltage < detected voltage. 1 generate internal reset signal (lvires) when supply voltage < detected voltage. lv i f note 2 low voltage detection flag 0 when supply voltage > detected voltage, or when operation is disabled 1 supply voltage of connected power supply < detected voltage notes 1. reset by low-voltage detection: 82h reset due to other source: 00h 2. the value of the lvif flag is output as the interrupt request signal (intlvi) when the lvion bit = 1 and lvimd bit = 0. cautions 1. when the lvion and lvimd bits to 1, the low-voltage detector cannot be stopped until the reset request due to other than th e low-voltage detection is generated. 2. when the lvion bit is set to 1, the comparator in the lvi circuit starts operating. wait 0.2 ms or longer by software before checking the voltage at the lvif bit after the lvion bit is set. 3. in the v850es/sj2-h, writing to the address (fffff890h) of the lvim register is prohibited. 4. be sure to clear bits 6 to 2 to ?0?.
chapter 27 low-voltage detector user?s manual u16603ej5v1ud 1038 (2) low voltage detection level selection register (lvis) the lvis register is used to select t he level of low voltage to be detected. this register can be read or written in 8-bit units. after reset: note r/w address: fffff891h 7 6 5 4 3 2 1 0 lvis 0 0 0 0 0 0 0 lvis0 lvis0 detection level 0 3.0 v 0.15 v 1 2.85 v 0.15 v (setting prohibited) note reset by low-voltage detection: retained reset due to other source: 00h cautions 1. this register cannot be written until a reset request due to something other than low-voltage detection is generated after the lvim.lvion and lvim.lvimd bits are set to 1. 2. in the v850es/sj2-h, writing to the address (fffff891h) of the lvis register is disabled. 3. be sure to clear bits 7 to 1 to ?0?.
chapter 27 low-voltage detector user?s manual u16603ej5v1ud 1039 27.4 operation depending on the setting of the lvim.vimd bit, an interrupt si gnal (intlvi) or an internal reset signal (lvires) is generated. how to specify each operation is described below, together with timing charts. 27.4.1 to use for internal reset signal (lvires) <1> mask the interrupt of lvi. <2> select the voltage to be detected by using the lvis.lvis0 bit. <3> set the lvim.lvion bit to 1 (to enable operation). <4> insert a wait cycle of 0.2 ms (max.) or more by software. <5> by using the lvim.lvif bit, check if the supply voltage > detected voltage. <6> set the lvimd bit to 1 (to generate an internal reset signal (lvires)). caution if lvimd bit is set to 1, the contents of the lvim and lvis registers cannot be changed until a reset request other than lvi is generated. figure 27-2. operation timing of low-voltage detector (lvimd bit = 1) supply voltage (v dd ) lvi detected voltage (3.0 0.15 v) lvion bit lvi detected signal lvires (active low) lvi reset request signal delay clear delay time
chapter 27 low-voltage detector user?s manual u16603ej5v1ud 1040 27.4.2 to use for interrupt (intlvi) <1> mask the interrupt of lvi. <2> select the voltage to be detected by using the lvis.lvis0 bit. <3> set the lvim.lvion bit to 1 (to enable operation). <4> insert a wait cycle of 0.2 ms (max.) or more by software. <5> by using the lvim.lvif bit, check if the supply voltage > detected voltage. <6> clear the interrupt request flag of lvi. <7> unmask the interrupt of lvi. clear the lvion bit to 0. figure 27-3. operation timing of low-voltage detector (lvimd bit = 0) external reset ic detected voltage reset pin intlvi signal supply voltage (v dd ) lvi detected voltage (3.0 0.15 v) lvion bit lvi detected signal internal reset signal (active low) delay clear delay time delay
chapter 27 low-voltage detector user?s manual u16603ej5v1ud 1041 27.5 ram retention voltage detection operation (p rovided to both v850es/sj2 and v850es/sj2-h) the supply voltage and detected voltage are compared. w hen the supply voltage drops below the detected voltage (including on power application), the rams.ramf bit is set to 1. figure 27-4. operation timing of ram retention voltage detection function supply voltage (v dd ) 2.0 v (minimum ram retention voltage) reset pin rams.ramf bit initialize ram (ramf bit is also cleared) when power application, ramf bit is set ram data is retained ramf bit = 0 is retained regardless of reset pin if v dd > 2.0 v initialize ram (ramf bit is also cleared) v dd < 2.0 v detected set ramf bit ram data is not retained remarks 1. the ramf bit is set to 1 if the supply volt age drops under the minimum ram retention voltage (2.0 v (typ.)). 2. the ramf bit operates regardl ess of the reset pin status.
chapter 27 low-voltage detector user?s manual u16603ej5v1ud 1042 27.6 emulation function (provided to both v850es/sj2 and v850es/sj2-h) when an in-circuit emulator is used, the operation of the ram retention flag (rams.ramf bit) can be pseudo- controlled and emulated by manipulating the pemu1 register on the debugger. this register is valid only in the emulation mode. it is invalid in the normal mode. (1) peripheral emulation register 1 (pemu1) after reset: 00h r/w address: fffff9feh 7 6 5 4 3 2 1 0 pemu1 0 0 0 0 0 evaramin 0 0 evaramin pseudo specification of ram retention voltage detection signal 0 do not detect voltage lower than ram retention voltage. 1 detect voltage lower than ram retention voltage (set ramf flag). caution this bit is not automatically cleared. [usage] when an in-circuit emulator is used, pseudo emulation of ramf is realiz ed by rewriting this register on the debugger. <1> cpu break (cpu operation stops.) <2> set the evaramin bit to 1 by using a register write command. by setting the evaramin bit to 1, the ramf bit is set to 1 on hardware (the internal ram data is invalid). <3> clear the evaramin bit to 0 by using a register write command again. unless this operation is performed (clearing the evar amin bit to 0), the ramf bit cannot be cleared to 0 by a cpu operation instruction. <4> run the cpu and resume emulation.
user?s manual u16603ej5v1ud 1043 chapter 28 regulator 28.1 outline the v850es/sj2 and v850es/sj2-h include a regula tor to reduce power consumption and noise. this regulator supplies a stepped-down v dd power supply voltage to the oscillator block and internal logic circuits (except the a/d converter, d/a converte r, and output buffers). the regulator output voltage is set to 2.5 v (typ.). figure 28-1. regulator ev dd i/o buffer bidirectional level shifter bv dd i/o buffer regulator a/d converter d/a converter bv dd av ref0 av ref1 flmd0 v dd ev dd regc flash memory main/sub oscillator internal digital circuits 2.5 v (typ.) caution use the regulator with a setting of v dd = ev dd = av ref0 = av ref1 bv dd .
chapter 28 regulator user?s manual u16603ej5v1ud 1044 28.2 operation the regulator of this product always operates in any mode (normal oper ation mode, halt mode, idle1 mode, idle2 mode, stop mode, or during reset). be sure to connect a capacitor (4.7 f (recommended value)) to the regc pin to stabilize the regulator output. a diagram of the regulator pin connection method is shown below. figure 28-2. regc pin connection reg input voltage voltage supply to oscillator/internal logic = 2.5 v (typ.) v dd regc 4.7 f (recommended) v ss
user?s manual u16603ej5v1ud 1045 chapter 29 rom correction function 29.1 overview the rom correction function is used to replace part of t he program in the internal rom with the program of an external memory or the internal ram. by using this function, program bugs found in the internal rom can be corrected. up to four addresses can be specified for correction. figure 29-1. block diagram of rom correction instruction address bus block replaced by dbtrap instruction instruction data bus rom dbtrap instruction generation block correction address register n (coradn) correction control register (corenn bit) comparator remark n = 0 to 3
chapter 29 rom correction function user?s manual u16603ej5v1ud 1046 29.2 registers (1) correction address registers 0 to 3 (corad0 to corad3) the corad0 to corad3 registers set the first addr ess of the program to be corrected in the rom. the program can be corrected at up to four places becau se four coradn registers are provided (n = 0 to 3). the coradn register can be read or written in 32-bit units. if the higher 16 bits of the coradn register are used as the coradnh register, and the lower 16 bits as the coradnl register, these registers can be read or written in 16-bit units. reset input clears these registers to 00000000h. because the rom capacity differs from one product to another, set the correction addresses in the following ranges. ? pd703264, 703264y, 703274, 703274y, 703284, 703284y, 70f3264, 70f3264y, 70f3274, 70f3274y, 70f3284, 70f3284y (384 kb): 0000000h to 005ffffh ? pd703265, 703265y, 703275, 703275y, 703285, 703285y, 703287, 703287y, 703265hy, 703275hy, 703285hy, 703287hy (512 kb): 0000000h to 007ffffh ? pd703266, 703266y, 703276, 703276y, 703286, 703286y , 703288, 703288y, 70f3266, 70f3266y, 70f3276, 70f3276y, 70f3286, 70f3286y, 70f3288, 70f3288y, 703266hy, 703276hy, 703286hy, 703288hy, 70f3266hy, 70f3276hy, 70 f3286hy, 70f3288hy (640 kb): 0000000h to 009ffffh after reset: 00000000h r/w address: correction address fixed to 0 0 coradn (n = 0 to 3) 31 18 19 1 0 correction address fixed to 0 0 coradn (n = 0 to 3) 31 19 20 1 0 (a) 384 kb, 512 kb (b) 640 kb note corad0 fffff840h, corad0l fffff840h, corad0h fffff842h, corad1 fffff844h, corad1l fffff844h, corad1h fffff846h, corad2 fffff848h, corad2l fffff848h, corad2h fffff84ah, corad3 fffff84ch, corad3l fffff84ch, corad3h fffff84eh note cleared to 0.
chapter 29 rom correction function user?s manual u16603ej5v1ud 1047 (2) correction control register (corcn) the corcn register disables or enables the correction op eration at the addresses set in the coradn register (n = 0 to 3). each channel can be enabled or disabled by this register. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 disabled enabled corenn 0 1 enables/disables correction operation corcn 0 0 0 coren3 coren2 coren1 coren0 after reset: 00h r/w address: fffff880h 0 1 2 3 4 5 6 7 remark n = 0 to 3 table 29-1. correspondence between corcn register bits and coradn registers corcn register bit corresponding coradn register coren3 corad3 coren2 corad2 coren1 corad1 coren0 corad0 29.3 rom correction operation and program flow <1> if the address to be corrected and the fetch address of t he internal rom match, the fetch code is replaced by the dbtrap instruction. <2> when the dbtrap instructio n is executed, execution branches to address 00000060h. <3> software processing after branching causes the resu lt of rom correction to be judged (the fetch address and rom correction operation are confirmed) and exec ution to branch to the correction software. <4> after the correction software has been executed, the re turn address is set, and return processing is started by the dbret instruction. caution the software that performs <3> and <4 > must be executed in the internal rom/ram.
chapter 29 rom correction function user?s manual u16603ej5v1ud 1048 figure 29-2. rom correction operation and program flow reset & start fetch address = coradn? coradn = dbpc-2? corenn bit = 1? perform initial settings of microcontroller set coradn register change fetch code to dbtrap instruction branch to rom correction judgment address branch to correction code address of corresponding channel n execute fetch code read data for setting rom correction from external memory execute dbtrap instruction jump to address 00000060h execute correction code execute dbret instruction write return address to dbpc. write value of psw to dbpsw as necessary. set corcn register yes yes yes no no remarks 1. : processing by user program (software) 2. n = 0 to 3 : processing by rom correction (hardware) load program for judgment of rom correction and correction codes execute fetch code ilgop processing no
chapter 29 rom correction function user?s manual u16603ej5v1ud 1049 29.4 cautions (1) when setting an address to be corrected in the coradn re gister, clear the higher bits to 0 in accordance with the capacity of the internal rom. (2) the rom correction function cannot be used to correct data in the internal rom. it can only be used to correct instruction codes. if rom correction is us ed to correct data, that dat a is replaced with a dbtrap instruction code. (3) rom correction is not performed in regards to the ro m code before writing in the corcnn register ends. (4) after executing a dbtrap instruction, the psw.np, ep , and di bits are set to 111, and interrupt/exception cannot be acknowledged. after executing a dbtrap inst ruction, change the psw register value as required. (5) the dbpc and dbpsw registers can be accessed while dbtrap instructions are being executed. (6) if the addresses of the instructions executed immediately after the corcn n register setting (enabled) are set as the correction addresses, normal operation may not be obtained (dbtrap is not generated).
user?s manual u16603ej5v1ud 1050 chapter 30 flash memory the following products are the flash memory ve rsions of the v850es/sj2 and v850es/sj2-h. caution there are differences in the amount of noise tolerance a nd noise radiation between flash memory versions and mask rom versions. when considering changing from a flash memory version to a mask rom version during the process from experimental manufacturing to mass production, make sure to sufficiently evaluate commercial samples (cs) (not engineering samples (es)) of the mask rom versions. for the electrical specificati ons related to the flash memory rewriting, see chapter 32 electrical specifications. ? pd70f3264, 70f3264y, 70f3274, 70f3274y, 70f3284, 70f3284y: 384 kb on-chip flash memory ? pd70f3266, 70f3266y, 70f3276, 70f3276 y, 70f3286, 70f3286y, 70f3288, 70f3288y, 70f3266hy, 70f3276hy, 70f3286hy, 70f3288hy: 640 kb on-chip flash memory flash memory versions are commonly used in the following development environments and mass production applications. { for altering software after the v850es/sj2 or v 850es/sj2-h is soldered onto the target system. { for data adjustment when starting mass production. { for differentiating software according to the specif ication in small scale production of various models. { for facilitating inventory management. { for updating software after shipment. 30.1 features { 4-byte/1-clock access (when instruction is fetched) { capacity: 640 kb/384 kb { write voltage: erase/write with a single power supply { rewriting method ? rewriting by communication with dedicated flash memory programmer via serial interface (on-board/off-board programming) ? rewriting flash memory by user program (self programming) { flash memory write prohibit f unction supported (security function) { safe rewriting of entire flash memory area by self programming using boot swap function { interrupts can be acknowledged during self programming.
chapter 30 flash memory user?s manual u16603ej5v1ud 1051 30.2 memory configuration the internal flash memory area of the v850es/sj2 and v850es/sj2-h is divided into block, as follows. ? v850es/sj2 640 kb: 16 blocks 384 kb: 12 blocks ? v850es/sj2-h 640 kb: 8 blocks can be programmed/erased in block units. all the blocks can also be erased at once. when the boot swap function is used, the physical memory located at the addresses of blocks 0 and 1 is replaced by the physical memory located at the addresses of bloc ks 2 and 3. for details of the boot swap function, see 30.5 rewriting by self programming .
chapter 30 flash memory user?s manual u16603ej5v1ud 1052 figure 30-1. flash memory mapping (1/2) (a) v850es/sj2 (640 kb/384 kb) 384 kb 640 kb note 00000000h 00020000h 0001ffffh 0000e000h 0000dfffh 0001e000h 0001dfffh 00007000h 00006fffh 000a0000h 0009ffffh 00080000h 0007ffffh 00060000h 0005ffffh 00040000h 0003ffffh block 0 (28 kb) block 2 (28 kb) block 1 (28 kb) block 3 (28 kb) block 4 (4 kb) block 8 (64 kb) internal flash memory area (640/384 kb) use prohibited use prohibited use prohibited external memory area (15 mb) internal ram area (48/32 kb) on-chip peripheral i/o area (4 kb) 0000000h 0100000h 00fffffh 1000000h 0ffffffh 3ff0000h 3feffffh 3fff000h 3ffefffh 3ffffffh 00090000h 0008ffffh 00050000h 0004ffffh 00030000h 0002ffffh 0001f000h 0001efffh 00070000h 0006ffffh 0001d000h 0001cfffh 0001c000h 0001bfffh 00015000h 00014fffh block 5 (4 kb) block 6 (4 kb) block 7 (4 kb) block 9 (64 kb) block 10 (64 kb) block 11 (64 kb) block 21 (64 kb) block 13 (64 kb) block 14 (64 kb) block 15 (64 kb) block 0 (28 kb) block 2 (28 kb) block 1 (28 kb) block 3 (28 kb) block 4 (4 kb) block 8 (64 kb) block 5 (4 kb) block 6 (4 kb) block 7 (4 kb) block 9 (64 kb) block 10 (64 kb) block 11 (64 kb) note blocks 0 and 1: boot area blocks 2 and 3: area used to replace boot area via boot swap function
chapter 30 flash memory user?s manual u16603ej5v1ud 1053 figure 30-1. flash memory mapping (2/2) (b) v850es/sj2-h (640 kb) note 00000000h 00020000h 0001ffffh 00010000h 0000ffffh 0001e000h 0001dfffh 0000e000h 0000dfffh 000a0000h 0009ffffh 00a0000h 009ffffh 00080000h 0007ffffh 00060000h 0005ffffh 00040000h 0003ffffh block 0 (56 kb) block 2 (56 kb) block 1 (8 kb) block 3 (8 kb) block 4 (128 kb) block 5 (128 kb) block 6 (128 kb) block 7 (128 kb) internal flash memory area (640 kb) use prohibited use prohibited use prohibited external memory area (15 mb) internal ram area (48 kb) on-chip peripheral i/o area (4 kb) 0000000h 0100000h 00fffffh 1000000h 0ffffffh 3ff0000h 3feffffh 3fff000h 3ffefffh 3ffffffh note blocks 0 and 1: boot area blocks 2 and 3: area used to replace boot area via boot swap function
chapter 30 flash memory user?s manual u16603ej5v1ud 1054 30.3 functional outline the internal flash memory of the v850es/sj2 and v850es/sj 2-h can be rewritten by using the rewrite function of the dedicated flash memory programmer, regardless of wh ether the v850es/sj2 or v850es/sj2-h has already been mounted on the target system or not (off-board/on-board programming). in addition, a security function that prohi bits rewriting the user program written to the internal flash memory is also supported, so that the program c annot be changed by an unauthorized person. the rewrite function using the user program (self programmi ng) is ideal for an application where it is assumed that the program is changed after production/sh ipment of the target syst em. a boot swap function t hat rewrites the entire flash memory area safely is also supported. in addition, interrupt servicing is supported during self programming, so that the flash memory can be rewritten und er various conditions, such as while communicating with an external device. table 30-1. rewrite method rewrite method functional outline operation mode on-board programming flash memory can be rewritten after the device is mounted on the target system, by using a dedicated flash memory programmer. off-board programming flash memory can be rewritten before the device is mounted on the target system, by using a dedicated flash memory programmer and a dedicated program adapter board (fa series). flash memory programming mode self programming flash memory can be rewritten by executing a user program that has been written to the flash memory in advance by means of off-board/on- board programming. (during self-programming, instructions cannot be fetched from or data access cannot be made to the internal flash memory area. therefore, the rewrite program must be transferred to the internal ram or external memory in advance). normal operation mode remark the fa series is a product of na ito densei machida mfg. co., ltd.
chapter 30 flash memory user?s manual u16603ej5v1ud 1055 table 30-2. basic functions support ( : supported, : not supported) function functional outline on-board/off-board programming self programming block erasure the contents of specified memory blocks are erased. chip erasure the contents of the entire memory area are erased all at once. write writing to specified addresses, and a verify check to see if write level is secured are performed. verify/checksum data read from the flash memory is compared with data transferred from the flash memory programmer. (can be read by user program) blank check the erasure status of the entire memory is checked. security setting use of the block erase command, chip erase command, and program command can be prohibited. (supported only when setting is changed from enable to prohibit) the following table lists the security functions. the bl ock erase command prohibit, chip erase command prohibit, and program command prohibit functions are enabled by default after shipment, and security can be set by rewriting via on-board/off-board programming. each security function can be used in combination with the others at the same time. table 30-3. security functions function function outline block erase command prohibit execution of a block erase command on all blocks is prohibited. setting of prohibition can be initialized by execution of a chip erase command. chip erase command prohibit execution of block erase and chip erase commands on all the blocks is prohibited. once prohibition is set, setting of prohibition cannot be initialized because the chip erase command cannot be executed. program command prohibit execution of program and block eras e commands on all the blocks is prohibited. setting of prohibition can be initialized by exec ution of the chip erase command. read command prohibit not supported (permanently prohibited). boot area rewrite prohibit not supported.
chapter 30 flash memory user?s manual u16603ej5v1ud 1056 table 30-4. security setting erase, write, read operations when each security is set ( : executable, : not executable, ? : not supported) notes on security setting function on-board/off-board programming self programming on-board/ off-board programming self programming block erase command prohibit block erase command: chip erase command: program command: read command: block erasure (flashblockerase): chip erasure: ? write (flashwordwrite): read (flashwordread): setting of prohibition can be initialized by chip erase command. chip erase command prohibit block erase command: chip erase command: program command: note read command: block erasure (flashblockerase): chip erasure: ? write (flashwordwrite): read (flashwordread): setting of prohibition cannot be initialized. program command prohibit block erase command: chip erase command: program command: read command: block erasure (flashblockerase): chip erasure: ? write (flashwordwrite): read (flashwordread): setting of prohibition can be initialized by chip erase command. supported only when setting is changed from enable to prohibit note in this case, since the erase command is invalid, dat a different from the data al ready written in the flash memory cannot be written.
chapter 30 flash memory user?s manual u16603ej5v1ud 1057 30.4 rewriting by dedicated flash memory programmer the flash memory can be rewritten by using a dedicat ed flash memory programmer after the v850es/sj2 or v850es/sj2-h is mounted on the target system (on-board programming). t he flash memory can also be rewritten before the device is mounted on the ta rget system (off-board programming) by using a dedicated program adapter (fa series). 30.4.1 programming environment the following shows the environment requi red for writing programs to the fl ash memory of the v850es/sj2 and v850es/sj2-h. figure 30-2. environment required fo r writing programs to flash memory host machine rs-232c dedicated flash memory programmer v850es/sj2, v850es/sj2-h flmd1 note v dd v ss reset uarta0/csib0/csib3 pg-fp4 (flash pro4) cxxxxxx bxxxxx axxxx xxx yyy x x x x x x x x x x x x x x x xxxx yyyy s tat v e flmd0 usb note connect the flmd1 pin to the flash memory programmer or connect to gnd via a pull-down resistor on the board. a host machine is required for controlling the dedicated flash memory programmer. uarta0, csib0, or csib3 is used for the interfac e between the dedicated flash memory programmer and the v850es/sj2 or v850es/sj2-h to perform wr iting, erasing, etc. a dedicated pr ogram adapter (fa series) required for off-board writing. remark the fa series is a product of na ito densei machida mfg. co., ltd.
chapter 30 flash memory user?s manual u16603ej5v1ud 1058 30.4.2 communication mode communication between the dedicated flash memory pr ogrammer and the v850es/sj2 or v850es/sj2-h is performed by serial communication using the uarta0, csib0, or csib3 interfaces of the v850es/sj2, v850es/sj2- h. (1) uarta0 transfer rate: 9,600 to 153,600 bps figure 30-3. communication with dedica ted flash memory programmer (uarta0) dedicated flash memory programmer v850es/sj2, v850es/sj2-h v dd v ss reset txda0 rxda0 flmd1 flmd1 note v dd gnd reset rxd txd pg-fp4 (flash pro4) cxxxxxx bxxxxx axxxx x xx y yy x x x x x x x x x x x x x x x x xxx y yyy statve flmd0 flmd0 note connect the flmd1 pin to the flash memory progra mmer or connect to gnd via a pull-down resistor on the board. (2) csib0, csib3 serial clock: 2.4 khz to 2.5 mhz (msb first) figure 30-4. communication with dedicated flash memory programmer (csib0, csib3) dedicated flash memory programmer v850es/sj2, v850es/sj2-h flmd1 note v dd v ss reset sob0, sob3 sib0, sib3 sckb0, sckb3 flmd1 v dd gnd reset si so sck pg-fp4 (flash pro4) cxxxxxx bxxxxx axxxx xxx yyy x x x x x x x x x x x x x x x xxxx yyyy statve flmd0 flmd0 note connect the flmd1 pin to the flash memory progra mmer or connect to gnd via a pull-down resistor on the board.
chapter 30 flash memory user?s manual u16603ej5v1ud 1059 (3) csib0 + hs, csib3 + hs serial clock: 2.4 khz to 2.5 mhz (msb first) figure 30-5. communication with dedicated flash memory programmer (csib0 + hs, csib3 + hs) dedicated flash memory programmer v850es/sj2, v850es/sj2-h v dd v ss reset sob0, sob3 sib0, sib3 sckb0, sckb3 pcm0 v dd flmd1 flmd1 note gnd reset si so sck hs pg-fp4 (flash pro4) cxxxxxx bxxxxx axxxx xxx yyy x x x x x x x x x x x x x x x xxxx yyyy statve flmd0 flmd0 note connect the flmd1 pin to the flash memory progra mmer or connect to gnd via a pull-down resistor on the board. the dedicated flash memory program mer outputs the transfer clock, and the v850es/sj2 and v850es/sj2-h operate as a slave. when the pg-fp4 or pg-fp5 is used as the dedicated flash memory progr ammer, it generates the following signals to the v850es/sj2 and v850es/sj2-h. for details, refer to the pg-fp4 user?s manual (u15260e) and the pg-fp5 user?s manual (u18865e) .
chapter 30 flash memory user?s manual u16603ej5v1ud 1060 table 30-5. signal connections of dedicate d flash memory programmer (pg-fp4, pg-fp5) pg-fp4, pg-fp5 v850es/sj2, v850es/sj2-h processing for connection signal name i/o pin function pin name uarta0 csib0, csib3 csib0 + hs, csib3 + hs flmd0 output write enable/disable flmd0 flmd1 output write enable/disable flmd1 note 1 note 1 note 1 vdd ? v dd voltage generation/voltage monitor v dd gnd ? ground v ss clk output clock output to v850es/sj2, v850es/sj2-h x1, x2 note 2 note 2 note 2 reset output reset signal reset si/rxd input receive signal sob0, sob3/ txda0 so/txd output transmit signal sib0, sib3/ rxda0 sck output transfer clock sckb0, sckb3 hs input handshake signal for csib0 + hs, csib3 + hs communication pcm0 notes 1. wire these pins as shown in figure 30-6, or c onnect them to gnd via pull-down resistor on board. 2. clock cannot be supplied via the clk pin of the fl ash memory programmer. create an oscillator on board and supply the clock. remark : must be connected. : does not have to be connected.
chapter 30 flash memory user?s manual u16603ej5v1ud 1061 table 30-6. wiring of v850es/sj2, v850es/sj2-h flash writing adapters (fa-144gj-uen-a) (1/2) flash memory programmer (pg-fp4, pg-fp5) connection pin csib0 + hs used csib0 used uarta0 used signal name i/o pin function name of fa board pin pin name pin no. pin name pin no. pin name pin no. si/rxd input receive signal si p41/sob0/ scl01 23 p41/sob0/ scl01 23 p30/txda0/ sob4 25 so/txd output transmit signal so p40/sib0/ sda01 22 p40/sib0/ sda01 22 p31/rxda0/ intp7/sib4 26 sck output transfer clock sck p42/sckb0 24 p42/sckb0 24 not needed ? x1 not needed ? not needed ? not needed ? clk output clock to v850es/sj2, v850es/sj2-h x2 not needed ? not needed ? not needed ? /reset output reset signal /reset reset 14 reset 14 reset 14 flmd0 output write voltage flmd0 flmd0 8 flmd0 8 flmd0 8 flmd1 output write voltage flmd1 pld5/ad5/ flmd1 110 pld5/ad5/ flmd1 110 pld5/ad5/ flmd1 110 hs input handshake signal for csi0 + hs communication reserve/ hs pcm0/wait 85 not needed ? not needed ? v dd 9 v dd 9 v dd 9 bv dd 104 bv dd 104 bv dd 104 ev dd 34 ev dd 34 ev dd 34 av ref0 1 av ref0 1 av ref0 1 vdd ? vdd voltage generation/volt age monitor vdd av ref1 5 av ref1 5 av ref1 5 v ss 11 v ss 11 v ss 11 av ss 2 av ss 2 av ss 2 bv ss 103 bv ss 103 bv ss 103 gnd ? ground gnd ev ss 33 ev ss 33 ev ss 33 cautions 1. be sure to connect the regc pin to gnd via 4.7 f capacitor. 2. clock cannot be supplied from the cl k pin of the flash memory programmer. create an oscillator on the board and supply clock.
chapter 30 flash memory user?s manual u16603ej5v1ud 1062 table 30-6. wiring of v850es/sj2, v850es/sj2-h flash writing adapters (fa-144gj-uen-a) (2/2) flash memory programmer (pg-fp4, pg-fp5) connection pin csib0 + hs used csib3 used signal name i/o pin function name of fa board pin pin name pin no. pin name pin no. si/rxd input receive signal si p911/a11/sob3 72 p911/a11/sob3 72 so/txd output transmit signal so p910/a10/sib3 71 p910/a10/sib3 71 sck output transfer clock sck p912/a12/sckb3 73 p912/a12/sckb3 73 x1 not needed ? not needed ? clk output clock to v850es/sj2, v850es/sj2-h x2 not needed ? not needed ? /reset output reset signal /reset reset 14 reset 14 flmd0 output write voltage flmd0 flmd0 8 flmd0 8 flmd1 output write voltage flmd1 pld5/ad5/flmd1 110 pld5/ad5/flmd1 110 hs input handshake signal for csi0 + hs communication reserve/hs pcm0/wait 85 not needed ? v dd 9 v dd 9 bv dd 104 bv dd 104 ev dd 34 ev dd 34 av ref0 1 av ref0 1 vdd ? vdd voltage generation/voltage monitor vdd av ref1 5 av ref1 5 v ss 11 v ss 11 av ss 2 av ss 2 bv ss 103 bv ss 103 gnd ? ground gnd ev ss 33 ev ss 33 cautions 1. be sure to connect the regc pin to gnd via 4.7 f capacitor. 2. clock cannot be supplied from the cl k pin of the flash memory programmer. create an oscillator on the board and supply clock.
chapter 30 flash memory user?s manual u16603ej5v1ud 1063 figure 30-6. wiring example of v850es/sj2, v850es/sj2-h flash writ ing adapters (fa-144gj-uen-a) (in csib0 + hs mode) (1/2) v850es/sj2, v850es/sj2-h vdd gnd gnd vdd gnd vdd vdd gnd 25 30 20 15 75 80 85 90 95 100 105 35 40 45 50 55 60 65 70 110 115 120 125 130 135 140 1 5 10 rfu-3 rfu-2 vde flmd1 flmd0 rfu-1 si so sck /reset v pp reserve/hs x1 x2 note 4 note 1 note 2 note 2 note 3 connect this pin to vdd. connect this pin to gnd. 4.7 f
chapter 30 flash memory user?s manual u16603ej5v1ud 1064 figure 30-6. wiring example of v850es/sj2, v850es/sj2-h flash writ ing adapters (fa-144gj-uen-a) (in csib0 + hs mode) (2/2) notes 1 . wire the flmd1 pin as shown below, or connect it to gnd on board via a pull-down resistor. 2. corresponding pins when csib3 is used. 3. create an oscillator on the flash writing adapte r (shown in broken lines) and supply a clock. here is an example of the oscillator. example: x1 x2 4. corresponding pins when uarta0 is used. caution do not input a high level to the drst pin. remarks 1. process the pins not shown in accordanc e with the handling of unused pins (see 2.3 pin i/o circuit types, i/o buffer power supplies, and connection of unused pins ). 2. this adapter is for the 144-pin plastic lqfp package.
chapter 30 flash memory user?s manual u16603ej5v1ud 1065 30.4.3 flash memory control the following shows the procedure for manipulating the flash memory. figure 30-7. procedure for manipulating flash memory start select communication system manipulate flash memory end? yes supplies flmd0 pulse no end switch to flash memory programming mode
chapter 30 flash memory user?s manual u16603ej5v1ud 1066 30.4.4 selection of communication mode in the v850es/sj2 and v850es/sj2-h, t he communication mode is selected by inputting pulses (12 pulses max.) to the flmd0 pin after switching to the flash memory programming mode. t he flmd0 pulse is generated by the dedicated flash memory programmer. the following shows the relationship between the number of pulses and the communication mode. figure 30-8. selection of communication mode v dd v dd reset (input) flmd1 (input) flmd0 (input) rxda0 (input) txda0 (output) v ss v dd v ss v dd v ss v dd v ss v dd v ss v dd v ss (note) power on oscillation stabilized communication mode selected flash control command communication (erasure, write, etc.) reset released note the number of clocks is as follows depending on the communication mode. flmd0 pulse communication mode remarks 0 uarta0 communication rate: 9,600 bps (after reset), lsb first 8 csib0 v850es/sj2, v850es/sj2-h perform slave operation, msb first 9 csib3 v850es/sj2, v850es/sj2-h perform slave operation, msb first 11 csib0 + hs v850es/sj2, v850es/sj2-h perform slave operation, msb first 12 csib3 + hs v850es/sj2, v850es/sj2-h perform slave operation, msb first other rfu setting prohibited caution when uarta0 is selected , the receive clock is calculate d based on the reset command sent from the dedicated flash memory progr ammer after receiving the flmd0 pulse.
chapter 30 flash memory user?s manual u16603ej5v1ud 1067 30.4.5 communication commands the v850es/sj2 and v850es/sj2-h communicate with t he dedicated flash memory programmer by means of commands. the signals sent from the dedicated flash memory programmer to the v850es/sj2 and v850es/sj2-h are called ?commands?. the response signals sent fr om the v850es/sj2 and v850es/sj 2-h to the dedicated flash memory programmer are called ?response commands?. figure 30-9. communication commands dedicated flash memory programmer v850es/sj2, v850es/sj2-h command response command pg-fp4 (flash pro4) cxxxxxx bxxxxx axxxx x x x y y y x x x x x x x x x x x x x x x x xx x y y yy statve the following shows the commands for flash memory contro l in the v850es/sj2 and v850 es/sj2-h. all of these commands are issued from the dedicated flash memo ry programmer, and the v850es/sj2 and v850es/sj2-h perform the processing corresponding to the commands. table 30-7. flash memory control commands support classification command name csib0, csib3 csib0 + hs, csib3 + hs uarta0 function blank check block blank check command checks if the contents of the memory in the specified block have been correctly erased. chip erase command erases the contents of the entire memory. erase block erase command erases the contents of the memory of the specified block. write write command writes the specified address range, and executes a contents verify check. verify command compares the contents of memory in the specified address range with data transferred from the flash memory programmer. verify checksum command reads the checksum in the specified address range. silicon signature command reads silicon signature information. system setting, control security setting command disables the chip erase command, enables the block erase command, and disables the write command.
chapter 30 flash memory user?s manual u16603ej5v1ud 1068 30.4.6 pin connection when performing on-board writing, mount a connector on t he target system to conne ct to the dedicated flash memory programmer. also, incorporate a function on-board to switch from the normal operation mode to the flash memory programming mode. in the flash memory programming mode, all the pins not used for flash memory programming become the same status as that immediately after rese t. therefore, pin handling is required when the external device does not acknowledge the status immediately after a reset. (1) flmd0 pin in the normal operation mode, input a voltage of v ss level to the flmd0 pin. in the flash memory programming mode, supply a write voltage of v dd level to the flmd0 pin. because the flmd0 pin serves as a write protection pin in the self programming mode, a voltage of v dd level must be supplied to the flmd0 pin via port control, etc., before writing to the flash memory. for details, see 30.5.5 (1) flmd0 pin . figure 30-10. flmd0 pin connection example v850es/sj2, v850es/sj2-h flmd0 dedicated flash memory programmer connection pin pull-down resistor (r flmd0 ) (2) flmd1 pin when 0 v is input to the flmd0 pin, t he flmd1 pin does not function. when v dd is supplied to the flmd0 pin, the flash memory programming mode is entered, so 0 v must be input to the flmd1 pin. the following shows an example of the connection of the flmd1 pin. figure 30-11. flmd1 pin connection example flmd1 pull-down resistor (r flmd1 ) other device v850es/sj2, v850es/sj2-h caution if the v dd signal is input to the flmd1 pin from another device during on-board writing and immediately after reset, isolate this signal.
chapter 30 flash memory user?s manual u16603ej5v1ud 1069 table 30-8. relationship between flmd0 and flmd1 pi ns and operation mode wh en reset is released flmd0 flmd1 operation mode 0 don?t care normal operation mode v dd 0 flash memory programming mode v dd v dd setting prohibited (3) serial interface pin the following shows the pins used by each serial interface. table 30-9. pins used by serial interfaces serial interface pins used uarta0 txda0, rxda0 csib0 sob0, sib0, sckb0 csib3 sob3, sib3, sckb3 csib0 + hs sob0, sib0, sckb0, pcm0 csib3 + hs sob3, sib3, sckb3, pcm0 when connecting a dedicated flash memory programmer to a serial interface pin that is connected to another device on-board, care should be taken to avoid conflic t of signals and malfunction of the other device. (a) conflict of signals when the dedicated flash memory progra mmer (output) is connected to a se rial interface pin (input) that is connected to another device (output), a conflict of signals occurs. to avoid the conflict of signals, isolate the connection to the other device or set the other device to the output high-impedance status. figure 30-12. conflict of signals (serial interface input pin) v850es/sj2, v850es/sj2-h input pin conflict of signals dedicated flash memory programmer connection pins other device output pin in the flash memory programming mode, the signal that the dedicated flash memory programmer sends out conflicts with signals another device outputs. therefore, isolate the signals on the other device side.
chapter 30 flash memory user?s manual u16603ej5v1ud 1070 (b) malfunction of other device when the dedicated flash memory programmer (output or input) is connected to a serial interface pin (input or output) that is connect ed to another device (input), the si gnal is output to the other device, causing the device to malfunction. to avoid th is, isolate the connection to the other device. figure 30-13. malfunction of other device v850es/sj2, v850es/sj2-h pin dedicated flash memory programmer connection pin other device input pin in the flash memory programming mode, if the signal the v850es/sj2 and v850es/sj2-h output affects the other device, isolate the signal on the other device side. v850es/sj2, v850es/sj2-h pin dedicated flash memory programmer connection pin other device input pin in the flash memory programming mode, if the signal the dedicated flash memory programmer outputs affects the other device, isolate the signal on the other device side.
chapter 30 flash memory user?s manual u16603ej5v1ud 1071 (4) reset pin when the reset signals of the dedicated flash memory pr ogrammer are connected to the reset pin that is connected to the reset signal generator on-board, a conflict of signals occurs. to avoid the conflict of signals, isolate the connection to the reset signal generator. when a reset signal is input from the user system in the flash memory programming mode, the programming operation will not be performed correctly. therefore, do not input signals other than the reset signals from the dedicated flash memory programmer. figure 30-14. conflict of signals (reset pin) v850es/sj2, v850es/sj2-h reset dedicated flash memory programmer connection pin reset signal generator conflict of signals output pin in the flash memory programming mode, the signal the reset signal generator outputs conflicts with the signal the dedicated flash memory programmer outputs. therefore, isolate the signals on the reset signal generator side. (5) port pins (including nmi) when the system shifts to the flash memory programmi ng mode, all the pins that are not used for flash memory programming are in the same st atus as that immediately after rese t. if the external device connected to each port does not recognize the st atus of the port immediately after reset, pins require appropriate processing, such as connecting to v dd via a resistor or connecting to v ss via a resistor. (6) other signal pins connect x1, x2, xt1, xt2, and regc in the same status as that in t he normal operation mode. during flash memory programming, input a low level to the drst pin or leave it open. do not input a high level. (7) power supply supply the same power (v dd , v ss , ev dd , ev ss , bv dd , bv ss , av ref0 , av ref1 , av ss ) as in normal operation mode.
chapter 30 flash memory user?s manual u16603ej5v1ud 1072 30.5 rewriting by self programming 30.5.1 overview the v850es/sj2 and v850es/sj2-h support a flash macro se rvice that allows the user program to rewrite the internal flash memory by itself. by using this interface a nd a self programming library that is used to rewrite the flash memory with a user application program, the flash memory can be rewritten by a user application transferred in advance to the internal ram or external memory. c onsequently, the user program can be upgraded and constant data can be rewritten in the field. figure 30-15. concept of self programming application program self programming library flash macro service flash memory flash function execution flash information erase, write
chapter 30 flash memory user?s manual u16603ej5v1ud 1073 30.5.2 features (1) secure self programming (boot swap function) the v850es/sj2 and v850es/sj2-h support a boot swap function that can exchange the physical memory of blocks 0 and 1 with the physical memory of blocks 2 and 3. by writing the start program to be rewritten to blocks 2 and 3 in advance and then swapping the physica l memory, the entire area can be safely rewritten even if a power failure occurs during rewriting because the correct user program always exists in blocks 0 and 1. figure 30-16. rewriting entire memory area (boot swap) last block block 5 block 4 block 3 block 2 block 1 block 0 last block block 5 block 4 block 3 block 2 block 1 block 0 last block block 5 block 4 block 3 block 2 block 1 block 0 boot swap rewriting blocks 2 and 3 (2) interrupt support the v850es/sj2 and v850es/sj2-h can execute interrupt servicing even while a flash function is executed during self-programming. if a maskable interrupt or non-maskable interrupt occurs, the servicing of each interrupt can be executed. two modes of interrupt servicing ar e available during self-programming. ? simple mode an interrupt handler can be registered by flash functi on flashsetuserhandler. ten interrupts can be used, but the later the interrupt is registered, the lower the response of the interrupt handler. ? custom mode an interrupt handler can be registered by the user by writing an interrupt vector at the beginning of the internal ram area. although the beginning of the inte rnal ram area is occupied, as many interrupts as required can be registered and the response of the in terrupts can be controlled, depending on the coding by the user.
chapter 30 flash memory user?s manual u16603ej5v1ud 1074 30.5.3 standard self programming flow the entire processing to rewrite the flash memory by flash self programming is illustrated below. figure 30-17. standard self programming flow flash environment initialization processing erase processing write processing flash information setting processing note 1 internal verify processing boot area swap processing note 2 flash environment end processing flash memory manipulation end of processing all blocks end? ? disable accessing flash area ? disable setting of stop mode ? disable stopping clock yes no notes 1. if a security setting is not performed, flash in formation setting processing does not have to be executed. 2. if boot swap is not used, flash information setting processing and boot swap processing do not have to be executed.
chapter 30 flash memory user?s manual u16603ej5v1ud 1075 30.5.4 flash functions table 30-10. flash function list function name outline support flashenv initialization of flash control macro flashblockerase erasure of only specified one block flashwordwrite writing from specified address flashblockiverify internal verification of specified block flashblockblankcheck blank check of specified block flashflmdcheck check of flmd pin flashstatuscheck status check of o peration specified immediately before flashgetinfo reading of flash information flashsetinfo setting of flash information flashbootswap swapping of boot area flashsetuserhandler user interrup t handler registration function 30.5.5 pin processing (1) flmd0 pin the flmd0 pin is used to set the operation mode when re set is released and to protect the flash memory from being written during self rewriting. it is therefore necessary to keep the voltage applied to the flmd0 pin at 0 v when reset is released and a normal operation is exec uted. it is also necessary to apply a voltage of v dd level to the flmd0 pin during the self programming m ode period via port control before the memory is rewritten. when self programming has been completed, the volt age on the flmd0 pin must be returned to 0 v. caution with the flash memory ver sion, the internal firmware operate s to support the boot swapping function after reset rele ase and before the start of the user program. to accurately start the user program operation, therefore, fix the flmd 0 pin to the low level for the duration of the oscillation stabilization time after th e reset signal is released, and until the firmware operation is comp leted (firmware operation time of the v850es/sj2 = 14,974 (1/f x ) seconds, firmware operation time of the v850es/sj2-h = 11,994 (1/f x ) seconds). figure 30-18. mode change timing reset signal flmd0 pin v dd 0 v v dd 0 v self programming mode normal operation mode normal operation mode caution make sure that the flmd0 pin is at 0 v when reset is released.
chapter 30 flash memory user?s manual u16603ej5v1ud 1076 30.5.6 internal resources used the following table lists the internal resources used for se lf programming. these internal resources can also be used freely for purposes ot her than self programming. table 30-11. internal resources used resource name description entry ram area (124 bytes of either internal ram/ external ram) routines and parameters used for the flash macr o service are located in this area. the entry program and default parameters are copied by calling a library initialization function. stack area (user stack + 300 bytes) an extension of the stack used by the user is used by the library (can be used in both the internal ram and external ram). library code (1,900 bytes) program entity of library (can be used anywhere other than the flash memory block to be manipulated). application program executed as user application. calls flash functions. maskable interrupt can be used in user application execut ion status or self programming status. to use this interrupt in the self programming status, the interrupt servicing start address must be registered in advance by a registration function. nmi interrupt can be used in user application execution status or self programming status. to use this interrupt in the self programming status the interrupt servicing start address must be registered in advance by a registration function.
user?s manual u16603ej5v1ud 1077 chapter 31 on-chip debug function the v850es/sj2 and v850es/sj2-h have an on-chip debug func tion that uses the jtag (joint test action group) interface (drst, dck, dms, ddi, and ddo pins) and th at can be used via an on-chip debug emulator (ie- v850e1-cd-nw, qb-v850mini). caution the on-chip debug function is pr ovided only in the flash memory version. it is not provided with the mask rom version. however, th e ocdm register also exists in the mask rom version and it controls the pull-down resistor connected to the p05/intp2 pin, so set the ocdm register even for the mask rom version. 31.1 features { hardware break function: 2 points { software break function: 4 points { real-time ram monitor function: memory cont ents can be read during program execution. { dynamic memory modification function (dmm function): ram contents can be rewritten during program execution. { mask function: reset, nmi, hldrq, wait { rom security function: 10-byte id code authentication caution the following func tions are not supported. ? trace function ? event function ? debug interrupt inte rface function (dbint)
chapter 31 on-chip debug function user?s manual u16603ej5v1ud 1078 31.2 connection circuit example ie-v850e1-cd-nw qb-v850mini v850es/sj2, v850es/sj2-h vdd dck dms ddi ddo drst reset flmd0 gnd v dd , ev dd dck dms ddi ddo drst note 2 reset flmd0 note 3 flmd1/pdl5 ev ss note 1 note 4 status target pow er notes 1. example of pin processing when on-chip debug emulator is not connected 2. a pull-down resistor is provided on chip. 3. for flash memory rewriting 4. this pin processing is necessary for rewriting the internal flash memory by connecting a flash memory programmer. 31.3 interface signals the interface signals are described below. (1) drst this is a reset input signal for the on-chip debug un it. it is a negative-logic signal that asynchronously initializes the debug control unit. the on-chip debug emulator raises the drst signal when it detects v dd of the target system after the integrated debugger is star ted, and starts the on-chip debug unit of the device. when the drst signal goes high, a reset signal is also generated in the cpu. when starting debugging by starti ng the integrated debugger, a cpu reset is always generated. (2) dck this is a clock input signal. it supplies a 20 mhz or 10 mhz clock from the on-chip debug emulator. in the on- chip debug unit, the dms and ddi signals are sampled at the rising edge of the dck signal, and the data ddo is output at its falling edge.
chapter 31 on-chip debug function user?s manual u16603ej5v1ud 1079 (3) dms this is a transfer mode select signal. the transfer st atus in the debug unit changes depending on the level of the dms signal. (4) ddi this is a data input signal. it is sampled in the on-chip debug unit at the rising edge of dck. (5) ddo this is a data output signal. it is output from the on- chip debug unit at the falling edge of the dck signal. (6) v dd , ev dd this signal is used to detect vdd of the target system. if vdd from t he target system is not detected, the signals output from the on-chip debug emulator (drs t, dck, dms, ddi, flmd0, and reset) go into a high- impedance state. (7) flmd0 the flash self programming function is used for the function to download data to the flash memory via the integrated debugger. during flash self programming, the flmd0 pin must be kept high. in addition, connect a pull-down resistor to the flmd0 pin. the flmd0 pin can be controlled in either of the following two ways. <1> to control from on-chip debug emulator connect the flmd0 signal of the on-ch ip debug emulator to the flmd0 pin. in the normal mode, nothing is driven by th e on-chip debug emulator (high impedance). during a break, the on-chip d ebug emulator raises t he flmd0 pin to the hi gh level when the download function of the integrated debugger is executed. <2> to control from port connect any port of the device to the flmd0 pin. the same port as the one used by the user program to realize the fl ash self programming function may be used. on the console of the integrated debugger, make a setting to raise the port pin to high level before executing the download function, or lower the port pin after executing the download function. for details, refer to the id850qb (integrated debugger) operation user?s manual . (8) reset this is a system reset input pin. if the drst pin is ma de invalid by the value of the ocdm0 bit of the ocdm register set by the user program, on-chip debugging ca nnot be executed. therefore, reset is effected by the on-chip debug emulator, using the reset pin, to make the drst pin valid (initialization).
chapter 31 on-chip debug function user?s manual u16603ej5v1ud 1080 31.4 register (1) on-chip debug m ode register (ocdm) the ocdm register is used to sele ct the normal operation mode or on-chip debug mode. this register is a special register and can be written only in a combination of specific sequences (see 3.4.8 special registers ). this register is also used to specify whether a pi n provided with an on-chip debug function is used as an on- chip debug pin or as an ordinary port/peripheral function pin. it also is used to disconnect the internal pull- down resistor of the p05/intp2/drst pin. the ocdm register can be written only while a low level is input to the drst pin. this register can be read or written in 8-bit or 1-bit units.
chapter 31 on-chip debug function user?s manual u16603ej5v1ud 1081 0 ocdm0 0 1 operation mode ocdm 0 0 0 0 0 0 ocdm0 after reset: 01h note r/w address: fffff9fch when drst pin is low: normal operation mode (in which a pin that functions alternately as an on-chip debug function pin is used as a port/peripheral function pin) when drst pin is high: on-chip debug mode (in which a pin that functions alternately as an on-chip debug function pin is used as an on-chip debug mode pin) selects normal operation mode (in which a pin that functions alternately as on-chip debug function pin is used as a port/peripheral function pin) and disconnects the on-chip pull-down resistor of the p05/intp2/drst pin. < > note reset by the reset pin sets this register to 01h . after reset by the ov erflow of watchdog timer (wdt2res), reset by the low-voltage detector (lvi) (lvires) (v850es/sj2 only), or reset by the clock monitor (clm) (clmres), however, the valu e of the ocdm register is retained. cautions 1. when using the ddi, ddo, dck, and dms pins not as on-chip debug pins but as port pins after external reset, any of the following actions must be taken. ? input a low level to the p05/intp2/drst pin. ? set the odcm0 bit. in this case, take the following actions. <1> clear the ocdm0 bit to 0. <2> fix the p05/intp2/drst pin to the low level until <1> is completed. 2. the drst pin has an on-chip pull-down resist or. this resistor is disconnected when the ocdm0 flag is cleared to 0. the mask rom version do es not have an on-chip debug function but it has the ab ove pull-down resistor. wi th the mask rom version also, therefore, the on-chip pull-down resistor must be disconnect ed by clearing the ocdm0 bit to 0. ocdm0 flag (1: pull-down on, 0: pull-down off) 10 to 100 k (30 k (typ.)) drst
chapter 31 on-chip debug function user?s manual u16603ej5v1ud 1082 31.5 operation the on-chip debug function is made invalid under the conditions shown in the table below. when this function is not used, keep the drst pin low until the ocdm.ocdm0 flag is cleared to 0. ocdm0 flag drst pin 0 1 l invalid invalid h invalid valid remark l: low-level input h: high-level input figure 31-1. timing when on-chip debug function is not used low-level input after ocdm0 bit is cleared, high level can be input/output. clearing ocdm0 bit releasing reset reset ocdm0 p05/intp2/drst
chapter 31 on-chip debug function user?s manual u16603ej5v1ud 1083 31.6 rom security function 31.6.1 security id the flash memory versions of the v850es/sj2 and v850es/ sj2-h perform authentication using a 10-byte id code to prevent the contents of the flash memory from being read by an unauthorized person during on-chip debugging by the on-chip debug emulator. set the id code in the 10-byte on-chip flash memory area from 0000070h to 0000079h to allow the debugger perform id authentication. if the ids match, the security is released and reading fl ash memory and using the on-chip debug emulator are enabled. ? set the 10-byte id code to 0000070h to 0000079h. ? bit 7 of 0000079h is the on-chip debug emul ator enable flag. (0: disable, 1: enable) ? when the on-chip debug emulator is started, the debugger requests id input. when the id code input on the debugger and the id code set in 0000070h to 0000079h match, the debugger starts. ? debugging cannot be performed if the on-chip debug emul ator enable flag is 0, even if the id codes match. 000007ah 000007bh 000007fh 0000080h 0000079h 0000070h 0000000h system reserved area (00h) note system reserved area security id (10 bytes) note values other than 00h can also be set. ? pd70f3264, 70f3264y, 70f 3274, 70f3274y, 70f3284, 70f3284y: ver. 1.0 ? pd70f3266, 70f3266y, 70f3276, 70 f3276y, 70f3286, 70f3286y, 70f3288, 70f3288y: ver. 1.x (x: arbitrary) ? pd70f3266hy, 70f3276hy, 70f3286hy, 70f32 88hy: no applicable versions with products other than the above, operations are not affected even if 00h is set to 0000007ah. caution when the data in the flash memory has been deleted, all the bits are set to 1.
chapter 31 on-chip debug function user?s manual u16603ej5v1ud 1084 31.6.2 setting example when the following values are set to addresses 0x70 to 0x79 address value 0x70 0x12 0x71 0x34 0x72 0x56 0x73 0x78 0x74 0x9a 0x75 0xbc 0x76 0xde 0x77 0xf1 0x78 0x23 0x79 0xd4 0x7a 0x00 reserved code (see 3.4.9 (3) .) the following shows program exampl es when the ca850 is used. [program example 1] following the ?ilgop? section (address 0x60), enter the 10 -byte security code and 1-byte system reserved area data (00h). #--------------------------------------- # ilgop handler #--------------------------------------- .section "ilgop" -- interrupt handler address 0x60 -- input ilgop handler code .org 0x10 -- skip handler address to 0x70 #--------------------------------------- # securityid (continue ilgop handler) #--------------------------------------- .word 0x78563412 --0-3 byte code .word 0xf1debc9a --4-7 byte code .hword 0xd423 --8-9 byte code .byte 0x00 --reserve code caution when using the ca850 ver. 3.00 or later, sp ecify the option for disab ling the generation of the security id. the security id addition function by linker is adde d from the ca850 ver. 3.00. as a result, errors occur during linking in th e above program example. error message: f4264: start address (0x00000070) of section "security_id" overlaps previous section "ilgop" ended before address (0xxxxxxxxx).
chapter 31 on-chip debug function user?s manual u16603ej5v1ud 1085 [program example 2] enter the 10-byte security code using t he ?security_id? section (address 0x70). #--------------------------------------- # security_id #--------------------------------------- .section "security_id" .word 0x78563412 --0-3 byte code .word 0xf1debc9a --4-7 byte code .hword 0xd423 --8-9 byte code caution data that can be set to th e ?security_id? section is limited to 10 bytes. for this reason, data cannot be set to the system rese rved area (0x7a) following the security code. consequently, when using a device that needs to set data to the system reser ved area, set the security code and system reserved area data using th e method shown in ?p rogram example 1?. for details on devices that need to set data to the system reser ved area, see 3.4.9 (3) system reserved area.
chapter 31 on-chip debug function user?s manual u16603ej5v1ud 1086 31.7 cautions (1) if a reset signal is input (from the target system or a reset signal from an internal reset source) during run (program execution), the br eak function may malfunction. (2) even if the reset signal is masked by the mask function, the i/o buffer (port pin) ma y be reset if a reset signal is input from a pin. (3) because a software breakpoint set in the internal flash me mory is realized by the ro m correction function, it is made temporarily invalid by target reset or internal reset generated by watchdog timer 2. the breakpoint becomes valid again when a hardware break or forced br eak occurs, but a software break does not occur until then. (4) pin reset during a break is masked and the cpu and per ipheral i/o are not reset. if pi n reset or internal reset is generated as soon as the flash memo ry is rewritten by dmm (dynamic memory modification) or read by the ram monitor function while the user program is being executed, the cpu and peripheral i/o may not be correctly reset. (5) emulation of rom corre ction cannot be executed. (6) when the following conditions (a) and (b) are sa tisfied and operation is st opped on the emulator (qb- v850essx2, ie-703288-g1-em1, ie-v850e1-cd-nw, qb-v 850mini) due to a break, etc., watchdog timer 2 does not stop and a reset or non-maskable interrupt occurs. when a reset occurs, the debugger hangs up. (a) the main clock or subclock is used as the source clock for watchdog timer 2. (b) the internal oscillation clock is stopped (rcm.rstop bit = 1). to avoid this, perform either of the following. ? when an emulator is used, the internal osci llation clock is used as the source clock. ? when an emulator is used, do not stop the internal oscillator. (7) when the following conditions (a) and (b) are sa tisfied and operation is st opped on the emulator (qb- v850essx2, ie-703288-g1-em1, ie-v850e1-cd-nw, qb-v850m ini) due to a break, etc., tmm does not stop even if the peripheral break function is set to ?break?. (a) either the intwt, internal oscillation clock (f r /8), or subclock is selected as the tmm source clock. (b) the main clock is stopped. to avoid this, perform either of the following. ? when an emulator is used, the main clock (f xx , f xx /2, f xx /4, f xx /64, f xx /512) is used as the source clock. ? when an emulator is used, do not stop the main clock oscillation. (8) in the on-chip debug mode, the ddo pin is forcibly set to the high-level output.
user?s manual u16603ej5v1ud 1087 chapter 32 electrical specifications 32.1 absolute maximum ratings (t a = 25 c) (1/2) parameter symbol conditions ratings unit v dd v dd = ev dd = av ref0 = av ref1 ? 0.5 to +4.6 v bv dd ? 0.5 to +4.6 v ev dd v dd = ev dd = av ref0 = av ref1 ? 0.5 to +4.6 v av ref0 v dd = ev dd = av ref0 = av ref1 ? 0.5 to +4.6 v av ref1 v dd = ev dd = av ref0 = av ref1 ? 0.5 to +4.6 v v ss v ss = ev ss = bv ss = av ss ? 0.5 to +0.5 v av ss v ss = ev ss = bv ss = av ss ? 0.5 to +0.5 v bv ss v ss = ev ss = bv ss = av ss ? 0.5 to +0.5 v supply voltage ev ss v ss = ev ss = bv ss = av ss ? 0.5 to +0.5 v v i1 reset, flmd0 note 1 ? 0.5 to ev dd + 0.5 note 2 v v i2 pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 ? 0.5 to bv dd + 0.5 note 2 v v i3 p10, p11 ? 0.5 to av ref1 + 0.5 note 2 v v i4 x1, x2, xt1, xt2 ? 0.5 to v ro note 3 + 0.5 note 2 v input voltage v i5 p00 to p06, p30 to p39, p40 to p42, p50 to p55, p60 to p615, p80, p81, p90 to p915 ? 0.5 to +6.0 v analog input voltage v ian p70 to p715 ? 0.5 to av ref0 + 0.5 note 2 v notes 1. flash memory version only 2. be sure not to exceed the absolute maximum ratings (max. value) of each supply voltage. 3. on-chip regulator output voltage (2.5 v (typ.))
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1088 (t a = 25 c) (2/2) parameter symbol conditions ratings unit per pin 4 ma p00 to p06, p30 to p39, p40 to p42, p50 to p55, p60 to p615, p80, p81, p90 to p915 total of all pins 50 ma per pin 4 ma pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 total of all pins 50 ma per pin 4 ma p10, p11 total of all pins 8 ma per pin 4 ma output current, low i ol p70 to p715 total of all pins 20 ma per pin ? 4 ma p00 to p06, p30 to p39, p40 to p42, p50 to p55, p60 to p615, p80, p81, p90 to p915 total of all pins ? 50 ma per pin ? 4 ma pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 total of all pins ? 50 ma per pin ? 4 ma p10, p11 total of all pins ? 8 ma per pin ? 4 ma output current, high i oh p70 to p715 total of all pins ? 20 ma operating ambient temperature t a ? 40 to +85 c mask rom versions ? 65 to +150 c storage temperature t stg flash memory versions ? 40 to +125 c cautions 1. do not directly connect the output (or i/o) pins of ic products to each other, or to v dd , v cc , and gnd. open-drain pins or open-collector pins , however, can be directly connected to each other. direct connection of the output pins betw een an ic product and an external circuit is possible, if the output pins can be set to the high-impedance state and the output timing of the external circuit is designed to avoid output conflict. 2. product quality may suffer if the absolute maximum rating is exceeded even momentarily for any parameter. that is, the absolute maximu m ratings are rated values at which the product is on the verge of suffering physical damage, and therefore the product must be used under conditions that ensure that th e absolute maximum ratings are not exceeded. the ratings and conditions indicated for dc characteristics an d ac characteristics represent the quality assurance range during normal operation. remark unless specified otherwise, the charac teristics of alternate-function pi ns are the same as those of port pins.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1089 32.2 capacitance (t a = 25 c, v dd = ev dd = bv dd = av ref0 = av ref1 = v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit i/o capacitance c io f x = 1 mhz unmeasured pins returned to 0 v 10 pf 32.3 operating conditions (1) v850es/sj2 (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) supply voltage internal system clock frequency conditions v dd ev dd bv dd av ref0 , av ref1 unit c = 4.7 f, a/d converter stop, d/a converter stop 2.85 to 3.6 2.85 to 3.6 2.7 to 3.6 2.85 to 3.6 v f xx = 2.5 to 20 mhz c = 4.7 f, a/d converter operating, d/a converter operating 3.0 to 3.6 3.0 to 3.6 2.7 to 3.6 3.0 to 3.6 v f xt = 32.768 khz c = 4.7 f, a/d converter stop, d/a converter stop 2.85 to 3.6 2.85 to 3.6 2.7 to 3.6 2.85 to 3.6 v (2) v850es/sj2-h (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) supply voltage internal system clock frequency conditions v dd ev dd bv dd av ref0 av ref1 unit f xx = 2.5 to 32 mhz f xt = 32.768 khz stabilization capacitance c = 4.7 f connected to regc pin, all function operating 3.0 to 3.6 3.0 to 3.6 3.0 to 3.6 3.0 to 3.6 3.0 to 3.6 v
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1090 32.4 oscillator characteristics 32.4.1 main clock oscillator characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) resonator circuit example parameter conditions min. typ. max. unit v850es/sj2 2.5 10 mhz oscillation frequency (f x ) note 1 v850es/sj2-h 2.5 8 mhz after reset is released 2 16 /f x s after stop mode is released 1 note 4 note 3 ms ceramic resonator/ crystal resonator x2 x1 oscillation stabilization time note 2 after idle2 mode is released 350 note 4 note 3 s notes 1. the oscillation frequency shown above indicates only oscillator characteristics. use the v850es/sj2 so that the internal operation conditions do not exceed the ratings shown in ac characteristics and dc characteristics . 2. time required from start of oscillation until the resonator stabilizes. 3. the value varies depending on the setting of the osts register. 4. time required to set up the flash memory (flash memo ry version only). secure the setup time using the osts register. cautions 1. when using the main clock oscillator, wir e as follows in the area encl osed by the broken lines in the above figure to avoid an ad verse effect from wiring capacitance. ? keep the wiring length as short as possible. ? do not cross the wiring with the other signal lines. ? do not route the wiring near a signal line through which a high fluctuating current flows. ? always make the ground point of the oscillator capacitor the same potential as v ss . ? do not ground the capacitor to a ground pattern through which a high current flows. ? do not fetch signals from the oscillator. 2. when the main clock is stopped and the de vice is operating on the subclock, wait until the oscillation stabilization time has been secured by the program before switching back to the main clock.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1091 (i) kyocera kinseki corporation: crystal resonator (t a = ? 40 to +85 c) recommended circuit constant oscillation voltage range manufacturer (part number) circuit example oscillation frequency f x (khz) c1 (pf) c2 (pf) rd (k ) min. (v) max. (v) 4,000 8 8 ? 2.85 3.6 5,000 8 8 ? 2.85 3.6 8,000 8 8 ? 2.85 3.6 10,000 8 8 ? 2.85 3.6 3,145.72 8 8 ? 2.85 3.6 4,718.592 8 8 ? 2.85 3.6 kyocera kinseki corporation - cx-5fd (capacitance: 8 pf) - cx-49g (capacitance: 8 pf) - hc-49/u-s (capacitance: 8 pf) about other resonator?s type name, refer to the resonator manufacturer. x2 x1 c2 c1 rd 6,291.456 8 8 ? 2.85 3.6 caution this oscillator constant is a reference value based on evaluati on under a specific environment by the resonator manufacturer. if optimization of oscillator ch aracteristics is necessary in the actual application, apply to the resonator manufacturer for evaluati on on the implementation circuit. the oscillation voltage and oscilla tion frequency indicate only o scillator characteristics. use the v850es/sj2 and v850es/sj2-h so that the inte rnal operating conditions are within the specifications of the dc and ac characteristics. remark contact: kyocera electronic components & devices http ://global.kyocera.com/prd ct/electro/index.html resonator vs. ic matching se arch http://www3.kyocera.co.jp/electro/app/en/searchtopshow.do
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1092 (ii) murata mfg. co. ltd.: ceramic resonator (t a = ? 40 to +85 c) recommended circuit constant oscillation voltage range manufacturer circuit example oscillation frequency f x (mhz) part number c1 (pf) c2 (pf) rd (k ) min. (v) max. (v) cstcr4m00g55b-r0 on-chip (39) on-chip (39) 0 2.85 3.6 4.000 cstcr4m00g15c**-r0 on-chip (39) on-chip (39) 0 2.85 3.6 cstcr5m00g55b-r0 on-chip (39) on-chip (39) 0 2.85 3.6 5.000 cstcr5m00g15c**-r0 on-chip (39) on-chip (39) 0 2.85 3.6 cstcr6m00g55b-r0 on-chip (39) on-chip (39) 0 2.85 3.6 6.000 cstcr6m00g15c**-r0 on-chip (39) on-chip (39) 0 2.85 3.6 cstce8m00g55a-r0 on-chip (33) on-chip (33) 0 2.85 3.6 8.000 cstce8m00g15c**-r0 on-chip (33) on-chip (33) 0 2.85 3.6 cstce10m0g55a-r0 on-chip (33) on-chip (33) 0 2.85 3.6 murata mfg. co. ltd. x2 x1 c2 c1 rd 10.000 cstce10m0g15c**-r0 on-chip (33) on-chip (33) 0 2.85 3.6 caution this oscillator constant is a reference value based on evaluati on under a specific environment by the resonator manufacturer. if optimization of oscillator ch aracteristics is necessary in the actual application, apply to the resonator manufacturer for evaluati on on the implementation circuit. the oscillation voltage and oscilla tion frequency indicate only o scillator characteristics. use the v850es/sj2 and v850es/sj2-h so that the inte rnal operating conditions are within the specifications of the dc and ac characteristics. remarks 1. the total tolerance of a product having ?**? in its part number can be adjusted up to 3000 ppm. 2. contact: product engineering service section piezoelectric components department i piezoelectric components division device business unit murata mfg. co., ltd. tel: +81-75-955-6915 e-mail: piezo@murata.co.jp ic part number -> ceramic resonator sear ch: http://search.murata.co.jp/ceramy/cemenu_en.do
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1093 32.4.2 subclock oscillator characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) resonator circuit example parameter conditions min. typ. max. unit oscillation frequency (f xt ) note 1 32 32.768 35 khz crystal resonator xt2 xt1 oscillation stabilization time note 2 10 s notes 1. the oscillation frequency shown above indicates only oscillator characteristics. use the v850es/sj2 and v850es/sj2-h so that the internal operation conditions do not exceed the ratings shown in ac characteristics and dc characteristics . 2. time required from when v dd reaches the following oscillation voltage range to when the crystal resonator stabilizes. ? v850es/sj2: 2.85 v (min.) ? v850es/sj2-h: 3.0 v (min.) cautions 1. when using the subclock oscillator, wire as follows in the area enclosed by the broken lines in the above figures to avoid an ad verse effect from wiring capacitance. ? keep the wiring length as short as possible. ? do not cross the wiring with the other signal lines. ? do not route the wiring near a signal line through which a high fluctuating current flows. ? always make the ground point of the oscillator capacitor the same potential as v ss . ? do not ground the capacitor to a ground pattern through which a high current flows. ? do not fetch signals from the oscillator. 2. the subclock oscillator is designed as a low-amplitude circuit for reducing power consumption, and is more prone to malfunction due to noise than the main clock oscillator. particular care is theref ore required with the wiring method when the subclock is used. 3. for the resonator selection and oscillator constant, customers are requested to either evaluate the oscillation themselves or apply to the resonator manufacturer for evaluation.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1094 32.4.3 pll characteristics (1) v850es/sj2 (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit 4 mode 2.5 5 mhz input frequency f x 8 mode 2.5 2.5 mhz 4 mode 10 20 mhz output frequency f xx 8 mode 20 20 mhz lock time t pll after v dd reaches 2.85 v (min.) 800 s (2) v850es/sj2-h (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit 4 mode 2.5 5 mhz input frequency f x 8 mode 2.5 4 mhz 4 mode 10 20 mhz output frequency f xx 8 mode 20 32 mhz lock time t pll after v dd reaches 3.0 v (min.) 800 s 32.4.4 internal oscill ator characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit output frequency f r 100 200 400 khz
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1095 32.5 regulator characteristics (1) v850es/sj2 (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit input voltage v dd f xx = 20 mhz (max.) 2.85 3.6 v output voltage v ro 2.5 v regulator output stabilization time t reg after v dd reaches 2.85 v (min.), stabilization capacitance c = 4.7 f connected to regc pin 1 ms (2) v850es/sj2-h (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit input voltage v dd f xx = 32 mhz (max.) 3.0 3.6 v output voltage v ro 2.5 v regulator output stabilization time t reg after v dd reaches 3.0 v (min.), stabilization capacitance c = 4.7 f connected to regc pin 1 ms v dd v ro t reg reset
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1096 32.6 dc characteristics 32.6.1 i/o level (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit v ih1 reset, flmd0 note 0.8ev dd ev dd v v ih2 p00 to p06, p30 to p37, p42, p50 to p55, p60 to p615, p80, p81, p92 to p915 0.8ev dd 5.5 v v ih3 p38, p39, p40, p41, p90, p91 0.7ev dd 5.5 v v ih4 pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 0.7bv dd bv dd v v ih5 p70 to p715 0.7av ref0 av ref0 v input voltage, high v ih6 p10, p11 0.7av ref1 av ref1 v v il1 reset, flmd0 note ev ss 0.2ev dd v v il2 p00 to p06, p30 to p37, p42, p50 to p55, p60 to p615, p80, p81, p92 to p915 ev ss 0.2ev dd v v il3 p38, p39, p40, p41, p90, p91 ev ss 0.3ev dd v v il4 pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 bv ss 0.3bv dd v v il5 p70 to p715 av ss 0.3av ref0 v input voltage, low v il6 p10, p11 av ss 0.3av ref1 v input leakage current, high i lih v i = v dd = ev dd = bv dd = av ref0 = av ref1 5 a input leakage current, low i lil v i = 0 v ? 5 a output leakage current, high i loh v o = v dd = ev dd = bv dd = av ref0 = av ref1 5 a output leakage current, low i lol v o = 0 v ? 5 a note flash memory version only remark unless specified otherwise, the charac teristics of alternate-function pi ns are the same as those of port pins.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1097 (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit per pin i oh = ? 1.0 ma total of all pins ? 20 ma ev dd ? 1.0 ev dd v v oh1 p00 to p06, p30 to p39, p40 to p42, p50 to p55, p60 to p615, p80, p81, p90 to p915 per pin i oh = ? 0.1 ma total of all pins ? 6.0 ma ev dd ? 0.5 ev dd v per pin i oh = ? 1.0 ma total of all pins ? 20 ma bv dd ? 1.0 bv dd v v oh2 pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 per pin i oh = ? 0.1 ma total of all pins ? 5.0 ma bv dd ? 0.5 bv dd v per pin i oh = ? 0.4 ma total of all pins ? 6.4 ma av ref0 ? 1.0 av ref0 v v oh3 p70 to p715 per pin i oh = ? 0.1 ma total of all pins ? 1.6 ma av ref0 ? 0.5 av ref0 v per pin i oh = ? 0.4 ma total of all pins ? 0.8 ma av ref1 ? 1.0 av ref1 v output voltage, high v oh4 p10, p11 per pin i oh = ? 0.1 ma total of all pins ? 0.2 ma av ref1 ? 0.5 av ref1 v v ol1 p00 to p06, p30 to p37, p42, p50 to p55, p60 to p615, p80, p81, p92 to p915 per pin i ol = 1.0 ma 0 0.4 v v ol2 p38, p39, p40, p41, p90, p91 per pin i ol = 3.0 ma total of all pins 20 ma 0 0.4 v v ol3 pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 per pin i ol = 1.0 ma total of all pins 20 ma 0 0.4 v output voltage, low v ol4 p10, p11, p70 to p715 per pin i ol = 0.4 ma total of all pins 7.2 ma 0 0.4 v software pull- down resistor r 1 p05 v i = v dd 10 30 100 k remarks 1. unless specified otherwise, the char acteristics of alternate-function pins are the same as those of port pins. 2. when the i oh and i ol conditions are not satisfied for a pin but t he total value of all pins is satisfied, only that pin does not satisf y the dc characteristics.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1098 32.6.2 supply current (1) v850es/sj2 (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit i dd1 normal operation f xx = 20 mhz (f x = 5 mhz), peripheral function operating 25 35 ma i dd2 halt mode f xx = 20 mhz (f x = 5 mhz), peripheral function operating 18 28 ma i dd3 idle1 mode f xx = 5 mhz (f x = 5 mhz), pll off 0.3 0.8 ma i dd4 idle2 mode f xx = 5 mhz (f x = 5 mhz), pll off 0.3 0.8 ma i dd5 subclock operating mode f xt = 32.768 khz, main clock, internal oscillator stopped 50 100 a i dd6 sub-idle mode f xt = 32.768 khz, main clock, internal oscillator stopped 15 70 a subclock stopped, internal oscillator stopped 6 50 a subclock operating, internal oscillator stopped 10 60 a supply current note 1 (mask rom version) i dd7 stop mode subclock stopped, internal oscillator operating 10 60 a note 2 35 55 ma i dd1 normal operation f xx = 20 mhz (f x = 5 mhz), peripheral function operating note 3 34 54 ma note 2 20 30 ma i dd2 halt mode f xx = 20 mhz (f x = 5 mhz), peripheral function operating note 3 19 28 ma i dd3 idle1 mode f xx = 5 mhz (f x = 5 mhz), pll off 0.8 1.6 ma i dd4 idle2 mode f xx = 5 mhz (f x = 5 mhz), pll off 0.3 0.8 ma note 2 300 600 a i dd5 subclock operating mode f xt = 32.768 khz, main clock, internal oscillator stopped note 3 200 400 a note 2 18 100 a i dd6 sub-idle mode f xt = 32.768 khz, main clock, internal oscillator stopped note 3 18 80 a subclock stopped, internal oscillator stopped 7 50 a subclock operating, internal oscillator stopped 10 60 a i dd7 stop mode subclock stopped, internal oscillator operating 10 60 a note 2 38 61 ma supply current note 1 (flash memory version) i dd8 flash memory programming mode f xx = 20 mhz (f x = 5 mhz) note 3 37 60 ma notes 1. total of v dd , ev dd , and bv dd currents. current flowing through t he output buffers, a/d converter, d/a converter, and on-chip pull-down resistor is not included. 2. 640 kb flash memory version: pd70f3266, 70f3266y, 70f3276, 70f3276y, 70f3286, 70f3286y, 70f3288, 70f3288y 3. 384 kb flash memory version: pd70f3264, 70f3264y, 70f3274, 70f3274y, 70f3284, 70f3284y
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1099 (2) v850es/sj2-h (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit i dd1 normal operation f xx = 32 mhz (f x = 4 mhz), peripheral function operating 35 55 ma i dd2 halt mode f xx = 32 mhz (f x = 4 mhz), peripheral function operating 27 40 ma i dd3 idle1 mode f xx = 4 mhz (f x = 4 mhz), pll off 0.3 0.8 ma i dd4 idle2 mode f xx = 4 mhz (f x = 4 mhz), pll off 0.3 0.8 ma i dd5 subclock operating mode f xt = 32.768 khz, main clock, internal oscillator stopped 50 100 a i dd6 sub-idle mode f xt = 32.768 khz, main clock, internal oscillator stopped 15 70 a subclock stopped, internal oscillator stopped 6 50 a subclock operating, internal oscillator stopped 10 60 a supply current note (mask rom version) i dd7 stop mode subclock stopped, internal oscillator operating 10 60 a i dd1 normal operation f xx = 32 mhz (f x = 4 mhz), peripheral function operating 50 70 ma i dd2 halt mode f xx = 32 mhz (f x = 4 mhz), peripheral function operating 30 40 ma i dd3 idle1 mode f xx = 4 mhz (f x = 4 mhz), pll off 0.8 1.6 ma i dd4 idle2 mode f xx = 4 mhz (f x = 4 mhz), pll off 0.3 0.8 ma i dd5 subclock operating mode f xt = 32.768 khz, main clock, internal oscillator stopped 300 600 a i dd6 sub-idle mode f xt = 32.768 khz, main clock, internal oscillator stopped 18 100 a subclock stopped, internal oscillator stopped 7 50 a subclock operating, internal oscillator stopped 10 60 a i dd7 stop mode subclock stopped, internal oscillator operating 10 60 a supply current note (flash memory version) i dd8 flash memory programming mode f xx = 32 mhz (f x = 4 mhz) 55 80 ma note total of v dd , ev dd , and bv dd currents. current flowing through the output buffers, a/d converte r, d/a converter, and on-chip pull-down resistor is not included.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1100 32.7 data retention characteristics (1) in stop mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit data retention voltage v dddr stop mode (all functions stopped) 1.9 3.6 v data retention current i dddr stop mode (all functions stopped) 7 50 a supply voltage rise time t rvd 200 s supply voltage fall time t fvd 200 s supply voltage retention time t hvd after stop mode setting 0 ms stop release signal input time t drel note 0 ms data retention input voltage, high v ihdr v dd = ev dd = bv dd = v dddr 0.9v dddr v dddr v data retention input voltage, low v ildr v dd = ev dd = bv dd = v dddr 0 0.1v dddr v note v850es/sj2: after v dd reaches 2.85 v (min.) v850es/sj2-h: after v dd reaches 3.0 v (min.) caution shifting to stop mode and restoring from stop mode must be performed within the rated operating range. t drel t hvd t fvd t rvd stop release signal input stop mode setting v dddr v ihdr v ihdr v ildr v dd /ev dd /bv dd reset (input) stop mode release interrupt (nmi, etc.) (released by falling edge) stop mode release interrupt (nmi, etc.) (released by rising edge) operating voltage lower limit
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1101 32.8 ac characteristics (1) ac test input measurement points (v dd , av ref0 , av ref1 , ev dd , bv dd ) v dd 0 v v ih v il v ih v il measurement points (2) ac test output measurement points v oh v ol v oh v ol measurement points (3) load conditions dut (device under measurement) c l = 50 pf caution if the load capaci tance exceeds 50 pf due to the circ uit configuration, bring the load capacitance of the device to 50 pf or less by in serting a buffer or by some other means.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1102 32.8.1 clkout output timing (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. max. unit v850es/sj2 50 ns 31.25 s output cycle t cyk <1> v850es/sj2-h 31.25 ns 31.25 s high-level width t wkh <2> t cyk /2 ? 10 ns low-level width t wkl <3> t cyk /2 ? 10 ns rise time t kr <4> 10 ns fall time t kf <5> 10 ns clock timing clkout (output) <1> <2> <3> <4> <5> 32.8.2 bus timing (1) in multiplexed bus mode caution when the v850es/sj2-h is operated at f xx > 20 mhz, be sure to insert the address hold wait and the address setup wait.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1103 (a) read/write cycle (clkout asynchronous) (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit address setup time (to astb ) t sast <6> (0.5 + t asw )t ? 20 ns address hold time (from astb ) t hsta <7> (0.5 + t ahw )t ? 15 ns note 1 16 ns delay time from rd to address float t frda <8> note 2 10 ns data input setup time from address t said <9> (2 + n + t asw + t ahw )t ? 35 ns data input setup time from rd t srid <10> (1 + n)t ? 25 ns delay time from astb to rd, wrm t dstrdwr <11> (0.5 + t ahw )t ? 15 ns data input hold time (from rd ) t hrdid <12> 0 ns note 1 (1 + i)t ? 15 ns address output time from rd t drda <13> note 2 (1 + i)t ? 10 ns note 1 0.5t ? 15 ns delay time from rd, wrm to astb t drdwrst <14> note 2 0.5t ? 10 ns note 1 (1.5 + i + t asw )t ? 15 ns delay time from rd to astb t drdst <15> note 2 (1.5 + i + t asw )t ? 10 ns note 1 (1 + n)t ? 15 ns rd, wrm low-level width t wrdwrl <16> note 2 (1 + n)t ? 10 ns note 1 (1 + i + t asw )t ? 15 ns astb high-level width t wsth <17> note 2 (1 + i + t asw )t ? 10 ns data output time from wrm t dwrod <18> 15 ns data output setup time (to wrm ) t sodwr <19> (1 + n)t ? 20 ns data output hold time (from wrm ) t hwrod <20> t ? 15 ns t sawt1 <21> n 1 (1.5 + t asw + t ahw )t ? 35 ns wait setup time (to address) t sawt2 <22> (1.5 + n + t asw + t ahw )t ? 35 ns t hawt1 <23> n 1 (0.5 + n + t asw + t ahw )t ns wait hold time (from address) t hawt2 <24> (1.5 + n + t asw + t ahw )t ns t sstwt1 <25> n 1 (1 + t ahw )t ? 25 ns wait setup time (to astb ) t sstwt2 <26> (1 + n + t ahw )t ? 25 ns t hstwt1 <27> n 1 (n + t ahw )t ns wait hold time (from astb ) t hstwt2 <28> (1 + n + t ahw )t ns notes 1. v850es/sj2 2. v850es/sj2-h remarks 1. t asw : number of address setup wait clocks t ahw : number of address hold wait clocks 2. t = 1/f cpu (f cpu : cpu operating clock frequency) 3. n: number of wait clocks inserted in the bus cycle the sampling timing changes when a programmable wait is inserted. 4. m = 0, 1 5. i: number of idle states inserted after a read cycle (0 or 1) 6. the values in the above specificat ions are values for when clocks with a 1:1 duty ratio are input from x1.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1104 read cycle (clkout asynchronous ): in multiplexed bus mode clkout (output) ad0 to ad15 (i/o) astb (output) rd (output) wait (input) t1 t2 tw t3 data address hi-z <6> <7> <17> <9> <12> <14> <10> <11> <25> <27> <26> <28> <21> <23> <22> <24> <16> <8> <13> <15> cs0 to cs3 (output) a16 to a23 (output) remark wr0 and wr1 are high level.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1105 write cycle (clkout asynchronous ): in multiplexed bus mode clkout (output) ad0 to ad15 (i/o) astb (output) wait (input) t1 t2 tw t3 data address <25> <27> <26> <28> <21> <23> <22> <24> <6> <17> <7> <14> <20> <19> <16> <11> <18> wr0, wr1 (output) cs0 to cs3 (output) a16 to a23 (output) remark rd is high level.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1106 (b) read/write cycle (clkout synchronous): in multiplexed bus mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit delay time from clkout to address t dka <29> 0 25 ns delay time from clkout to address float t fka <30> 0 19 ns delay time from clkout to astb t dkst <31> ? 12 7 ns delay time from clkout to rd, wrm t dkrdwr <32> ? 5 14 ns data input setup time (to clkout ) t sidk <33> 15 ns data input hold time (from clkout ) t hkid <34> 5 ns data output delay time from clkout t dkod <35> 19 ns wait setup time (to clkout ) t swtk <36> 20 ns wait hold time (from clkout ) t hkwt <37> 5 ns remarks 1. m = 0, 1 2. the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1. read cycle (clkout synchronous ): in multiplexed bus mode clkout (output) cs0 to cs3 (output) a16 to a23 (output) ad0 to ad15 (i/o) astb (output) rd (output) wait (input) t1 t2 tw t3 data address hi-z <29> <31> <32> <30> <31> <32> <36> <36> <37> <37> <33> <34> remark wr0 and wr1 are high level.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1107 write cycle (clkout synchronous ): in multiplexed bus mode clkout (output) ad0 to ad15 (i/o) astb (output) wait (input) t1 t2 tw t3 data address <29> <31> <32> <32> <37> <37> <36> <36> <31> <35> cs0 to cs3 (output) a16 to a23 (output) wr0, wr1 (output) remark rd is high level.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1108 (2) in separate bus mode cautions 1. when the v850es/sj2-h is operated at f xx > 20 mhz, be sure to insert an address hold wait and an address setup wait. 2. when the v850es/sj2-h is operated at f xx > 20 mhz, be sure to insert at least one data wait. (a) read cycle (clkout asynchronous): in separate bus mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit v850es/sj2 (0.5 + t asw )t ? 23 ns address setup time (to rd ) t sard <38> v850es/sj2-h (0.5 + t asw )t ? 25 ns address hold time (from rd ) t hard <39> it + 1 ns rd low-level width t wrdl <40> (1.5 + n + t ahw )t ? 10 ns data setup time (to rd ) t sisd <41> 23 ns data hold time (from rd ) t hisd <42> 0 ns data setup time (to address) t said <43> (2 + n + t asw + t ahw )t ? 40 ns t srdwt1 <44> (0.5 + t ahw )t ? 25 ns wait setup time (to rd ) t srdwt2 <45> (0.5 + n + t ahw )t ? 25 ns t hrdwt1 <46> (n ? 0.5 + t ahw )t ns wait hold time (from rd ) t hrdwt2 <47> (n + 0.5 + t ahw )t ns t sawt1 <48> (1 + t asw + t ahw )t ? 45 ns wait setup time (to address) t sawt2 <49> (1 + n + t asw + t ahw )t ? 45 ns t hawt1 <50> (n + t asw + t ahw )t ns wait hold time (from address) t hawt2 <51> (1 + n + t asw + t ahw )t ns remarks 1. t asw : number of address setup wait clocks t ahw : number of address hold wait clocks 2. t = 1/f cpu (f cpu : cpu operating clock frequency) 3. n: number of wait clocks inserted in the bus cycle the sampling timing changes when a programmable wait is inserted 4. i: number of idle states inserted after a read cycle (0 or 1) 5. the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1109 read cycle (clkout asynchr onous): in separate bus mode clkout (output) t1 <43> hi-z hi-z <38> <40> <47> <45> <46> <44> <48> <50> <49> <51> <42> <41> <39> tw t2 rd (output) cs0 to cs3 (output) a0 to a23 (output) ad0 to ad15 (i/o) wait (input) remark wr0 and wr1 are high level.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1110 (b) write cycle (clkout asynchronous): in separate bus mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit v850es/sj2 (1 + t asw + t ahw )t ? 23 ns address setup time (to wrm ) t sawr <52> v850es/sj2-h (1 + t asw + t ahw )t ? 25 ns address hold time (from wrm ) t hawr <53> 0.5t ? 10 ns wrm low-level width t wwrl <54> (0.5 + n)t ? 10 ns data output time from wrm t dosdw <55> ? 5 ns data setup time (to wrm ) t sosdw <56> (0.5 + n)t ? 20 ns data hold time (from wrm ) t hosdw <57> 0.5t ? 10 ns data setup time (to address) t saod <58> (1 + t asw + t ahw )t ? 25 ns t swrwt1 <59> 22 ns wait setup time (to wrm ) t swrwt2 <60> nt ? 22 ns t hwrwt1 <61> 0 ns wait hold time (from wrm ) t hwrwt2 <62> nt ns t sawt1 <63> (1 + t asw + t ahw )t ? 45 ns wait setup time (to address) t sawt2 <64> (1 + n + t asw + t ahw )t ? 45 ns t hawt1 <65> (n + t asw + t ahw )t ns wait hold time (from address) t hawt2 <66> (1 + n + t asw + t ahw )t ns remarks 1. m = 0, 1 2. t asw : number of address setup wait clocks t ahw : number of address hold wait clocks 3. t = 1/f cpu (f cpu : cpu operating clock frequency) 4. n: number of wait clocks inserted in the bus cycle the sampling timing changes when a programmable wait is inserted. 5. the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1111 write cycle (clkout asynchr onous): in separate bus mode clkout (output) t1 <58> <52> <55> <54> <62> <60> <61> <59> <63> <65> <64> <66> <57> <56> <53> tw t2 wr0, wr1 (output) cs0 to cs3 (output) a0 to a23 (output) ad0 to ad15 (i/o) wait (input) hi-z hi-z remark rd is high level.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1112 (c) read cycle (clkout synchronous): in separate bus mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit v850es/sj2 2 25 ns delay time from clkout to address t dksa <67> v850es/sj2-h 2 27 ns data input setup time (to clkout ) t sisdk <68> 20 ns data input hold time (from clkout ) t hkisd <69> 0 ns v850es/sj2 ? 2 12 ns delay time from clkout to rd t dksr <70> v850es/sj2-h ? 2 14 ns wait setup time (to clkout ) t swtk <71> 20 ns wait hold time (from clkout ) t hkwt <72> 0 ns remark the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1. read cycle (clkout synchronous, 1 wait): in separate bus mode clkout (output) t1 <70> <71> <72> <71> <72> <67> <70> <68> <69> hi-z hi-z tw t2 rd (output) cs0 to cs3 (output) a0 to a23 (output) ad0 to ad15 (i/o) wait (input) <67> remark wr0 and wr1 are high level.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1113 (d) write cycle (clkout synchronous): in separate bus mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit v850es/sj2 2 25 ns delay time from clkout to address t dksa <73> v850es/sj2-h 2 27 ns delay time from clkout to data output t dksd <74> 2 15 ns v850es/sj2 ? 2 12 ns delay time from clkout to wrm t dksw <75> v850es/sj2-h ? 2 14 ns wait setup time (to clkout ) t swtk <76> 20 ns wait hold time (from clkout ) t hkwt <77> 0 ns remarks 1. m = 0, 1 2. the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1. write cycle (clkout synchronous ): in separate bus mode clkout (output) t1 <74> <75> <77> <76> <75> tw t2 wr0, wr1 (output) cs0 to cs3 (output) a0 to a23 (output) ad0 to ad15 (i/o) wait (input) <73> <73> <77> <76> <74> hi-z hi-z remark rd is high level.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1114 (3) bus hold (a) clkout asynchronous (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit hldrq high-level width t whqh <78> t + 10 ns hldak low-level width t whal <79> t ? 15 ns v850es/sj2 ? 3 ns delay time from hldak to bus output t dhac <80> v850es/sj2-h ? 5 ns delay time from hldrq to hldak t dhqha1 <81> (2n + 7.5)t + 25 ns delay time from hldrq to hldak t dhqha2 <82> 0.5t 1.5t + 25 ns remarks 1. t = 1/f cpu (f cpu : cpu operating clock frequency) 2. n: number of wait clocks inserted in the bus cycle the sampling timing changes when a programmable wait is inserted. 3. the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1. bus hold (clkout asynchronous) clkout (output) hldrq (input) hldak (output) address bus (output) data bus (i/o) th th th ti ti hi-z cs0 to cs3 (output) hi-z astb (output) rd (output), wr0, wr1 (output) hi-z hi-z <78> <82> <79> <80> <81>
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1115 (b) clkout synchronous (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit hldrq setup time (to clkout ) t shqk <83> 20 ns hldrq hold time (from clkout ) t hkhq <84> 5 ns delay time from clkout to bus float t dkf <85> 19 ns delay time from clkout to hldak t dkha <86> 19 ns remark the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1. bus hold (clkout synchronous) clkout (output) hldrq (input) hldak (output) address bus (output) data bus (i/o) th th th t2 t3 ti ti hi-z cs0 to cs3 (output) hi-z astb (output) hi-z hi-z <83> <83> <86> <86> <84> <85> rd (output), wr0, wr1 (output)
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1116 32.9 basic operation (1) power on/power off/reset timing (t a = ? 40 to +85 c, v ss = av ss = bv ss = ev ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit ev dd v dd t rel <87> 0 ns ev dd bv dd t reb <88> 0 t rel ns ev dd av ref0 , av ref1 t rea <89> 0 t rel ns ev dd reset t rer <90> 500 + t reg note ns analog noise elimination (during flash erase/writing) 500 ns reset low-level width t wrsl <91> analog noise elimination 500 ns reset v dd t fre <92> 500 ns v dd ev dd t fel <93> 0 ns bv dd ev dd t feb <94> 0 t fel ns av ref0 , av ref1 ev dd t fea <95> 0 t fel ns note depends on the on-chip regulator characteristics. v dd ev dd bv dd v i v i v i v i av ref0 , av ref0 reset (input) <88> <87> <90> <92> <91> <89> <94> <93> <95>
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1117 (2) interrupt, flmd0 pin timing (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit nmi high-level width t wnih analog noise elimination 500 ns nmi low-level width t wnil analog noise elimination 500 ns n = 0 to 8 (analog noise elimination) 500 ns intpn note high-level width t with n = 3 (digital noise elimination) 3t smp + 20 ns n = 0 to 8 (analog noise elimination) 500 ns intpn note low-level width t witl n = 3 (digital noise elimination) 3t smp + 20 ns flmd0 high-level width t wmdh 500 ns flmd0 low-level width t wmdl 500 ns note the drst pin has the same characteristics as the intp2 pin. remark t smp : noise elimination sampling clock cycle (3) key return timing (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref 0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit krn high-level width t wkrh analog noise elimination 500 ns krn low-level width t wkrl analog noise elimination 500 ns remark n = 0 to 7 (4) timer timing (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit ti high-level width t tih 2t + 20 ns ti low-level width t til tip00, tip01, tip10, tip11, tip20, tip21, tip30, tip31, tip40, tip41, tip50, tip51, tip60, tip61, tip70, tip71, tip80, tip81, tiq00 to tiq03 2t + 20 ns remark t = 1/f xx (5) uart timing (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit transmit rate 312.5 kbps asck0 cycle time 10 mhz
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1118 (6) csib timing (a) master mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit sckbn cycle time t kcy1 <96> 125 ns sckbn high-/low-level width t kh1 , t kl1 <97> t kcy1 /2 ? 5 ns sibn setup time (to sckbn ) t sik1 <98> 30 ns sibn hold time (from sckbn ) t ksi1 <99> 30 ns delay time from sckbn to sobn output t kso1 <100> 30 ns remark n = 0 to 5 (b) slave mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit sckbn cycle time t kcy2 <96> 125 ns sckbn high-/low-level width t kh2 , t kl2 <97> 57.5 ns sibn setup time (to sckbn ) t sik2 <98> 30 ns sibn hold time (from sckbn ) t ksi2 <99> 30 ns v850es/sj2 30 ns delay time from sckbn to sobn output t kso2 <100> v850es/sj2-h 35 ns remark n = 0 to 5 sobn (output) input data output data sibn (input) sckbn (i/o) <96> <97> <97> <98> <99> <100> hi-z hi-z remark n = 0 to 5
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1119 (7) i 2 c bus mode (i 2 c bus versions (y products) only) (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) normal mode high-speed mode parameter symbol min. max. min. max. unit scl0n clock frequency f clk 0 100 0 400 khz bus free time (between start and stop conditions) t buf <101> 4.7 ? 1.3 ? s hold time note 1 t hd: sta <102> 4.0 ? 0.6 ? s scl0n clock low-level width t low <103> 4.7 ? 1.3 ? s scl0n clock high-level width t high <104> 4.0 ? 0.6 ? s setup time for start/restart conditions t su: sta <105> 4.7 ? 0.6 ? s cbus compatible master 5.0 ? ? ? s data hold time i 2 c mode t hd: dat <106> 0 note 2 ? 0 note 2 0.9 note 3 s data setup time t su: dat <107> 250 ? 100 note 4 ? ns sda0n and scl0n signal rise time t r <108> ? 1000 20 + 0.1cb note 5 300 ns sda0n and scl0n signal fall time t f <109> ? 300 20 + 0.1cb note 5 300 ns stop condition setup time t su: sto <110> 4.0 ? 0.6 ? s pulse width of spike suppressed by input filter t sp <111> ? ? 0 50 ns capacitance load of each bus line cb ? 400 ? 400 pf notes 1. at the start condition, the first clock pulse is generated after the hold time. 2. the system requires a minimum of 300 ns hold time internally for the sda0n signal (at v ihmin. of scl0n signal) in order to occupy the undefined area at the falling edge of scl0n. 3. if the system does not extend the scl0n signal low hold time (t low ), only the maximum data hold time (t hd : dat ) needs to be satisfied. 4. the high-speed mode i 2 c bus can be used in the normal-mode i 2 c bus system. in this case, set the high-speed mode i 2 c bus so that it meets the following conditions. ? if the system does not extend the sc l0n signal?s low state hold time: t su : dat 250 ns ? if the system extends the scl0n signal?s low state hold time: transmit the following data bit to the sda0n line prior to the scl0n line release (t rmax. + t su:dat = 1,000 + 250 = 1,250 ns: normal mode i 2 c bus specification). 5. cb: total capacitance of one bus line (unit: pf) remark n = 0 to 2
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1120 stop condition start condition restart condition stop condition scl0n (i/o) sda0n (i/o) <103> <109> <109> <108> <108> <106> <107> <105> <102> <101> <102> <111> <110> <104> remark n = 0 to 2 (8) iebus controller (products with iebus controller only) (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. typ. max. unit 5.91 6.00 note 6.09 mhz iebus system clock frequency f s communication mode: modes 1, 2 6.20 6.29 note 6.38 mhz note iebus system clock frequencies 6.0 mhz and 6.29 mhz cannot be used together.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1121 (9) can timing (products with can controller only) (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref 0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit transmit rate 1 mbps internal delay time t node 100 ns can internal clock (f can ) ctxdn pin (transmit data) crxdn pin (receive data) t output t input remarks 1. can internal clock (f can ): can baud rate clock 2. n = 0, 1 internal delay time (t node ) = internal transm ission delay time (t output ) + internal reception delay time (t input ) can controller v850es/sj2, v850es/sj2-h internal transmission delay time (t output ) ctxdn pin crxdn pin internal reception delay time (t input ) remark n = 0, 1
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1122 (10) a/d converter (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , 3.0 v av ref0 3.6 v, v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. typ. max. unit resolution 10 bit overall error note 3.0 av ref0 3.6 v 0.6 %fsr conversion time t conv 2.6 24 s zero scale error 0.5 %fsr full scale error 0.5 %fsr non-linearity error 4.0 lsb differential linearity error 4.0 lsb analog input voltage v ian av ss av ref0 v reference voltage av ref0 3.0 3.6 v normal conversion mode 3 6.5 ma high-speed conversion mode 4 10 ma av ref0 current ai ref0 when a/d converter unused 5 a note excluding quantization error ( 0.05 %fsr). caution do not set (read/write) alternate-function por ts during a/d conversion; otherwise the conversion resolution may be degraded. remark lsb: least significant bit fsr: full scale range (11) d/a converter (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , 3.0 v av ref1 3.6 v, v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. typ. max. unit resolution 8 bit overall error note 1 r = 2 m 1.2 %fsr settling time c = 20 pf 3 s output resistor r o output data 55h 3.5 k reference voltage av ref1 3.0 3.6 v d/a conversion operating 1 2.5 ma av ref1 current note 2 ai ref1 d/a conversion stopped 5 a notes 1. excluding quantization error ( 0.5 lsb). 2. value of 1 channel of d/a converter remark r is the output pin load resistance and c is the output pin load capacitance.
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1123 (12) lvi circuit specification (v850es/sj2 only) (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. typ. max. unit detection voltage v lvi0 2.85 3.0 3.15 v response time note t ld after v dd reaches v lvi0 /v lvi1 (max.), or after v dd drops to v lvi0 /v lvi1 (max.) 0.2 2.0 ms minimum pulse width t lw 0.2 ms reference voltage stabilization waiting time t lwait after v dd reaches 2.85 v (min.) 0.1 0.2 ms note time required to detect the detection voltage and output the interrupt or reset signal. t lwait t lw t ld t ld lvion bit = 0 1 supply voltage (v dd ) time detection voltage (min.) operating voltage (min.) detection voltage (typ.) detection voltage (max.)
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1124 (13) ram retention detection (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. typ. max. unit detection voltage v ramh 1.9 2.0 2.1 v supply voltage rise time t ramhth v dd = 0 to 2.85 v (v850es/sj2) v dd = 0 to 3.0 v (v850es/sj2-h) 0.002 ms response time note t ramhd after v dd reaches 2.1 v 0.2 2.0 ms minimum pulse width t ramhw 0.2 ms note time required to detect the detection voltage and set the rams.ramf bit. supply voltage (v dd ) time detection voltage (min.) operating voltage (min.) detection voltage (typ.) detection voltage (max.) t ramhw t ramhd t ramhd t ramhth rams.ramf bit cleared by instruction
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1125 32.10 flash memory programming characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) (1) basic characteristics parameter symbol conditions min. typ. max. unit v850es/sj2 2.5 20 mhz operating frequency f cpu v850es/sj2-h 2.5 32 mhz v850es/sj2 2.85 3.6 v supply voltage v dd v850es/sj2-h 3.0 3.6 v number of rewrites c wrt 100 times programming temperature t prg ? 40 +85 c (2) serial write operation characteristics parameter symbol conditions min. typ. max. unit flmd0, flmd1 setup time t mdset 2 3,000 ms flmd0 count start time from reset t rfcf f x = 2.5 to 10 mhz (v850es/sj2) f x = 2.5 to 8 mhz (v850es/sj2-h) 17,855/f x + s flmd0 counter high-level width/ low-level width t ch /t cl 10 100 s flmd0 counter rise time/fall time t r /t f 50 ns remark = oscillation stabilization time flash write mode setup timing v dd flmd1 0 v v dd reset (input) 0 v v dd flmd0 0 v t rfcf t cl t f t r t ch t mdset
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1126 (3) programming characteristics (a) v850es/sj2 parameter symbol conditions min. typ. max. unit note 1 304 ms note 2 1,405 ms block erase time f xx = 20 mhz note 3 3,057 ms write time per 256 bytes f xx = 20 mhz 8.1 ms note 1 20 ms note 2 141 ms block internal verify time f xx = 20 mhz note 3 322 ms note 1 9.2 ms note 2 64 ms block blank check time f xx = 20 mhz note 3 147 ms flash memory information setting time f xx = 20 mhz 1.0 ms notes 1. block size = 4 kb 2. block size = 28 kb 3. block size = 64 kb caution when writing initially to shipped products, it is counted as one rewrite for both ?erase to write? and ?write only?. example (p: write, e: erase) shipped product ?? p e p e p: 3 rewrites shipped product e p e p e p: 3 rewrites
chapter 32 electrical specifications user?s manual u16603ej5v1ud 1127 (b) v850es/sj2-h parameter symbol conditions min. typ. max. unit note 1 651.3 ms note 2 3,081.9 ms block erase time f xx = 32 mhz note 3 6,727.7 ms write time per 256 bytes f xx = 32 mhz 8.7 ms note 1 49.0 ms note 2 342.9 ms block internal verify time f xx = 32 mhz note 3 783.9 ms note 1 22.7 ms note 2 159.2 ms block blank check time f xx = 32 mhz note 3 364.0 ms flash memory information setting time f xx = 32 mhz 1.1 ms notes 1. block size = 8 kb 2. block size = 56 kb 3. block size = 128 kb caution when writing initially to shipped products, it is counted as one rewrite for both ?erase to write? and ?write only?. example (p: write, e: erase) shipped product ?? p e p e p: 3 rewrites shipped product e p e p e p: 3 rewrites
user?s manual u16603ej5v1ud 1128 chapter 33 package drawing 108 73 136 109 144 72 37 144-pin plastic lqfp (fine pitch) (20x20) item millimeters note a 22.0 0.2 b 20.0 0.2 c 20.0 0.2 d f 1.25 22.0 0.2 s144gj-50-uen s 1.5 0.1 k 1.0 0.2 l 0.5 0.2 r3 + 4 ? 3 g 1.25 h 0.22 0.05 i 0.08 j 0.5 (t.p.) m 0.17 n 0.08 p 1.4 q 0.10 0.05 + 0.03 ? 0.07 each lead centerline is located within 0.08 mm of its true position (t.p.) at maximum material condition. s s m detail of lead end i j f g h q r p k m l n cd s a b
user?s manual u16603ej5v1ud 1129 chapter 34 recommended soldering conditions these products should be soldered and mount ed under the following recommended conditions. for technical information, see the following website. semiconductor device mount manual (h ttp://www.necel.com/pkg/en/mount/index.html) table 34-1. surface mounting type soldering cond itions (1/2) (1) 144-pin plastic lqfp (fine pitch) (20 20 ) pd703264gj-xxx-uen-a, 703264ygj-xxx-uen-a, 703 265gj-xxx-uen-a, 703265ygj-xxx-uen-a, 703266gj-xxx-uen-a, 703266ygj-xxx-uen-a, 70327 4gj-xxx-uen-a, 703274ygj-xxx-uen-a, 703275gj-xxx-uen-a, 703275ygj-xxx-uen-a, 70327 6gj-xxx-uen-a, 703276ygj-xxx-uen-a, 703284gj-xxx-uen-a, 703284ygj-xxx-uen-a, 70328 5gj-xxx-uen-a, 703285ygj-xxx-uen-a, 703286gj-xxx-uen-a, 703286ygj-xxx-uen-a, 70328 7gj-xxx-uen-a, 703287ygj-xxx-uen-a, 703288gj-xxx-uen-a, 703288ygj-xxx-uen-a, 70f3264gj-uen-a, 70f3264ygj-uen-a, 70f3266gj-uen-a, 70f3266ygj-uen -a, 70f3274gj-uen-a, 70f3274ygj -uen-a, 70f3276gj-uen-a, 70f3276ygj-uen-a, 70f3284gj-uen- a, 70f3284ygj-uen-a, 70f3286gj- uen-a, 70f3286ygj-uen-a, 70f3288gj-uen-a, 70f3288ygj-u en-a, 703265hygj-xxx-uen-a, 703266hygj-xxx-uen-a, 70f3266hygj-uen-a, 703275hygj-xxx-uen-a, 703276hygj-xxx-uen-a, 70f3276hygj-uen-a, 703285hygj-xxx-uen-a, 703286hygj-xxx-uen-a, 703287hygj-xxx-uen-a, 703288hygj-xxx-uen-a, 70f3286hygj-uen-a, 70f3288hygj-uen-a soldering method soldering conditions recommended condition symbol infrared reflow package peak temperature: 260 c, time: 60 seconds max. (at 220c or higher), count: 3 times or less, exposure limit: 7 days note (after that, prebake at 125c for 20 to 72 hours) ir60-207-3 partial heating pin temperature: 350c max., time: 3 seconds max. (per pin row) ? note after opening the dry pack, store it at 25c or less and 65% rh or less for the allowable storage period. caution do not use different soldering methods together ( except for partial heating). remarks 1. the v850es/sj2 and v850es/sj 2-h are lead-free products. 2. for soldering methods and conditions other than those recommended above, please contact an nec electronics sales representative.
user?s manual u16603ej5v1ud 1130 appendix a development tools the following development tools are av ailable for the development of system s that employ t he v850es/sj2 or v850es/sj2-h. figure a-1 shows the developm ent tool configuration. ? support for pc98-nx series unless otherwise specified, pr oducts supported by ibm pc/at tm compatibles are compatible with pc98-nx series computers. when using pc98-nx series computer s, refer to the explanation for ibm pc/at compatibles. ? windows tm unless otherwise specified, ?windows? means the following oss. ? windows 98 ? windows 2000 ? windows me ? windows xp ? windows nt tm ver. 4.0
appendix a development tools user?s manual u16603ej5v1ud 1131 figure a-1. development tool configuration (1/4) (1) when using in-circuit emulator ie-v850es-g1 language processing software ? c compiler package ? device file debugging software ? integrated debugger ? system simulator host machine (pc or ews) interface adapter in-circuit emulator (ie-v850es-g1) note 2 conversion socket or conversion adapter target system flash memory programmer flash memory write adapter flash memory ? project manager (windows only) note 1 software package control software embedded software ? real-time os ? network library ? file system power supply unit flash memory write environment notes 1. the project manager pm+ is incl uded in the c compiler package. the pm+ is only used for windows. 2. products other than in-circuit emulator ie-v850es-g1 are all sold separately.
appendix a development tools user?s manual u16603ej5v1ud 1132 figure a-1. development tool configuration (2/4) (2) when using iecube ? qb-v850essx2 language processing software ? c compiler package ? device file debugging software ? integrated debugger ? system simulator host machine (pc or ews) usb interface cable in-circuit emulator (qb-v850essx2) note 2 conversion socket or conversion adapter target system flash memory write adapter flash memory ? project manager (windows only) note 1 software package control software embedded software ? real-time os ? network library ? file system power supply unit flash memory write environment flash memory programmer notes 1. the project manager pm+ is incl uded in the c compiler package. the pm+ is only used for windows. 2. in-circuit emulator qb-v850essx2 is suppli ed with integrated debugger id850qb, a simple programmer pg-fpl, power supply unit, and usb inte rface cable. any other products are sold separately.
appendix a development tools user?s manual u16603ej5v1ud 1133 figure a-1. development tool configuration (3/4) (3) when using on-chip debug emulator ie-v850e1-cd-nw language processing software ? c compiler package ? device file debugging software ? integrated debugger ? system simulator host machine (pc or ews) interface adapter note 2 on-chip debug emulator (ie-v850e1-cd-nw) note 3 target device (n-wire interface) target connector connector conversion board target system flash memory write adapter flash memory ? project manager (windows only) note 1 software package control software embedded software ? real-time os ? network library ? file system flash memory write environment flash memory programmer notes 1. the project manager pm+ is incl uded in the c compiler package. the pm+ is only used for windows. 2. the ie-v850e1-cd-nw supports only the pcmcia card interface. 3. the ie-v850e1-cd-nw is supplied with an id850qb, ie connection cable, ie connector, and connector conversion board. all ot her products are sold separately.
appendix a development tools user?s manual u16603ej5v1ud 1134 figure a-1. development tool configuration (4/4) (4) when using minicube ? qb-v850mini language processing software ? c compiler package ? device file debugging software ? integrated debugger ? system simulator host machine (pc or ews) usb interface cable note 2 on-chip debug emulator (qb-v850mini) note 3 ocd cable target device (n-wire interface) target connector connector conversion board target system flash memory write adapter flash memory ? project manager (windows only) note 1 software package control software embedded software ? real-time os ? network library ? file system flash memory write environment flash memory programmer notes 1. the project manager pm+ is incl uded in the c compiler package. the pm+ is only used for windows. 2. the qb-v850mini supports the usb interface. 3. the qb-v850mini is supplied with a kel connecto r and kel adapter as target connectors and connector conversion board in addition to an id850qb, usb interface cable, and ocd cable. all other target connectors are sold separately.
appendix a development tools user?s manual u16603ej5v1ud 1135 a.1 software package development tools (software) common to t he v850 microcontroller are combined in this package. sp850 v850 microcontroller software package part number: s sp850 remark in the part number differs depending on the host machine and os used. s sp850 host machine os supply medium ab17 windows (japanese version) bb17 pc-9800 series, ibm pc/at compatibles windows (english version) cd-rom a.2 language processing software this compiler converts programs written in c language into object codes executable with a microcontroller. this compiler is started from project manager pm+. ca850 c compiler package part number: s ca703000 df703288/df703288h note device file this file contains information peculiar to the device. this device file should be used in co mbination with a tool (ca850 or id850). the corresponding os and host machine di ffer depending on the tool to be used. note v850es/sj2: df703288 v850es/sj2-h: df703288h remark in the part number differs depending on the host machine and os used. s ca703000 host machine os supply medium ab17 windows (japanese version) bb17 pc-9800 series, ibm pc/at compatibles windows (english version) 3k17 sparcstation tm sunos tm (rel. 4.1.4), solaris tm (rel. 2.5.1) cd-rom a.3 control software pm+ project manager this is control software designed to enable e fficient user program development in the windows environment. all operations used in development of a user program, such as starting the editor, building, and starting the debugger, can be performed from pm+. pm+ is included in the c compiler package ca850. it can only be used in windows.
appendix a development tools user?s manual u16603ej5v1ud 1136 a.4 debugging tools (hardware) a.4.1 when using in-circu it emulator ie-v850es-g1 the system configuration when connec ting the ie-703288-g1-em1 to the ie-v850es-g1 and use it connecting to the host machine (pc-9800 series, pc/at compatible) is shown below. figure a-2. system configuration (ie-v850es-g1 used) <1> <2> <3> <4> <6> <7> <9> <8> <10> target system <5> <1> <2> <3> <4> <6> <7> <9> <8> <10> target system <5> <1> host machine (pc-9800 series, pc/at compatibles) <2> debugger <3> device file <4> pc interface board (for pci bus or pcmcia) <5> pc interface cable (supplied with the ie-v850es-g1) <6> power supply cable (supplied with the ie-v850es-g1) <7> in-circuit emulator (ie-v850es-g1) <8> in-circuit emulator emulation board (ie-703288-g1-em1) <9> probe (supplied with the ie-703288-g1-em1) <10> ev-703288gj144
appendix a development tools user?s manual u16603ej5v1ud 1137 <7> ie-v850es-g1 in-circuit emulator the in-circuit emulator serves to debug har dware and software when developing application systems using a v850 microcontroller product. it corresponds to the integrated debugger id850. this emulator should be used in co mbination with a power supply unit, emulation probe, and the interface adapter required to connect this emulator to the host machine. <4> ie-70000-cd-if-a pc card interface this is pc card and interface cable requir ed when using a notebook-type computer as the host machine (pcmcia socket compatible). <4> ie-70000-pci-if-a interface adapter this adapter is required when using a computer with a pci bus as the host machine. <8> ie-703288-g1-em1 emulation board this board emulates the operations of the peri pheral hardware peculiar to a device. it should be used in combination with an in-circuit emulator. <9> gxp-cable emulation probe this probe is used to connect the in-circuit emul ator and target system. this is supplied with emulation board ie-703288-g1-em1. <10> ev-703288gj144 conversion adapter this conversion adapter is used to connect th e emulation probe and target system board on which a 144-pin plastic lqfp (gj-uen type) can be mounted. remarks 1. the numbers in the square brackets correspond to the numbers in figure a-2. 2. ev-703288gj144 is a product of application corporation. tel: +81-42-732-1377 application corporation
appendix a development tools user?s manual u16603ej5v1ud 1138 a.4.2 when using iecube qb-v850essx2 the system configuration when connec ting the qb-v850essx2 to the host machine (pc-9821 series, pc/at compatible) is shown below. if no option pro ducts are prepared, connection is possible. figure a-3. system configuration (qb-v850essx2 used) (1/2) qb-mini2 <1> <12> mount adapter for device mounting <13> target connector for mounting on target system <8> exchange adapter exchanges pins among different microcontroller types <9> check pin adapter (s type only) enables signal monitoring <10> space adapter each adapter can adjust height by 5.6 mm. <14> target system <7> extension probe probe can be connected (s and t types) <12> mount adapter for device mounting <13> target connector for mounting on target system <11> yq connector connector for connecting to emulator <8> exchange adapter exchanges pins among different microcontroller types <10> space adapter each adapter can adjust height by 3.2 mm. <6> check pin adapter (under development) enables signal monitoring (s and t types) <5> iecube s-type socket configuration optional required <4> power supply <2> cd-rom <3> usb cable <14> target system t-type socket configuration system configuration accessories <1> host machine (pc-9821 series, ibm-pc/at compatibles) <2> debugger, usb driver, manuals, etc. (id850qb disk, accessory disk note 1 ) <3> usb interface cable <4> ac adapter <5> in-circuit emulator (qb-v850essx2) <6> check pin adapter (common to s and t types) (qb-144-ca-01) (option) <7> extension probe coaxial type (common to s and t types) (qb-144-ep-01s) (option) <8> exchange adapter note 2 (s type: qb-144gj-ea-01s, t type: qb-144gj-ea-01t) <9> check pin adapter note 3 (s type only) (qb-144-ca-01s) (option) <10> space adapter note 3 (s type: qb-144-sa-01s, t type: qb-144gj-ys-01t) (option) <11> yq connector note 2 (t type only) (qb-144gj-yq-01t) <12> mount adapter (s type: qb-144gj-ma -01s, t type: qb-144gj-hq-01t) (option) <13> target connector note 2 (s type: qb-144gj-tc-01s, t type: qb-144gj nq-01t) <14> target system
appendix a development tools user?s manual u16603ej5v1ud 1139 figure a-3. system configur ation (qb-v850essx2 used) (2/2) notes 1. obtain the device file from the nec electronics website. http://www.necel.com/micro/ods/jpn/index.html 2. depending on the ordering nu mber, supplied with the device. ? when qb-v850essx2-zzz is ordered the exchange adapter and the ta rget connector are not supplied. ? when qb-v850essx2-s144gj is ordered the qb-144gj-ea-01s and qb-144gj-tc-01s are supplied. ? when qb-v850essx2-t144gj is ordered the qb-144gj-ea-01t, qb-144gj-yq- 01t, and qb-144gj-nq-01t are supplied. 3. when using both <9> and <10>, the order between <9> and <10> is not cared. <5> qb-v850essx2 note in-circuit emulator the in-circuit emulator serves to debug har dware and software when developing application systems using a v850es/sj2 or v850es/sj2- h product. it supports the integrated debugger id850qb. this emulator should be used in combination with a power supply unit and emulation probe. use usb to connect this emulator to the host machine. <3> usb interface cable cable to connect the host machine and the qb-v850essx2. <4> ac adapter 100 to 240 v can be supported by replacing the ac plug. <8> qb-144gj-ea-01s, qb-144gj-ea-01t exchange adapter adapter to perform pin conversion. <9> qb-144-ca-01s check pin adapter adapter used in waveform monitoring using the oscilloscope, etc. <10> qb-144-sa-01s, qb-144gj-ys-01t space adapter adapter to adjust the height. <12> qb-144gj-ma-01s, qb-144gj-hq-01t mount adapter adapter to mount the v850es/sj2 or v850es/sj2-h with socket. <13> qb-144gj-tc-01s, qb-144gj-nq-01t target connector connector to solder on the target system. note the qb-v850essx2 is supplied with a power supply uni t, usb interface cable, an d qb-mini2. it is also supplied with integrated debugger id850qb as control software. remark the numbers in the square brackets correspond to the numbers in figure a-3.
appendix a development tools user?s manual u16603ej5v1ud 1140 a.4.3 when using on-chip debug emulator ie-v850e1-cd-nw the system configuration when connec ting the ie-v850e1-cd-nw to the host machine (pc-9821 series, pc/at compatible) is shown below. figure a-4. system configuration (ie-v850e1-cd-nw used) <6> <5> target system <1> <3> <4> <2> v850es/sj2, v850es/sj2-h flash memory version <1> host machine personal computer including pcmcia compliant with the pcmcia2.1/jeida standard ver. 4.2. when using a product which does not have a pcmcia slot, use a pci-pcmcia conversion board or the like. for details on the conversion board, consult an nec electronics sales representative. <2> cd-rom note 1 the integrated debugger id850qb, n-wire checker, device driver, documents and so on in the cd-rom format are included. this cd-rom is supplied with the ie- v850e1-cd-nw. <3> ie-v850e1-cd-nw on-chip debug emulator this on-chip debug emulator is used to debug hardware and software when application systems using the v850es/ sj2 and v850es/sj2-h are developed. it supports the integrated debugger id850qb. <4> ie-v850e1-cd-nw connection cable this connection cable is used to conne ct the ie-v850e1-cd-nw and the target system. it is supplied with the ie-v850e1- cd-nw. the cable length is approximately 50 cm. <5> connector conversion board kel adapter it is supplied with the ie-v850e1-cd-nw. <6> ie-v850e1-cd-nw connector kel connector note 2 8830e-026-170s (it is supplied with the ie-v850e1-cd-nw.) 8830e-026-170l (sold separately) notes 1. obtain the device file from the nec electronics website. http://www.necel.com/micro/ods/eng/index.html 2. product of kel corporation remark the numbers in the table correspo nd to the numbers in figure a-4.
appendix a development tools user?s manual u16603ej5v1ud 1141 a.4.4 when using minicube qb-v850mini the system configuration when con necting the qb-v850mini to the host machine (pc-9821 series, pc/at compatible) is shown below. figure a-5. system confi guration (qb-v850mini used) s t a t u s t a r g e t p o w e r <1> <4> <5> <6> <7> <8> <9> device file <3> <2> target system target system v850es/sj2, v850es/sj2-h flash memory version <1> host machine (with on-chip usb port) <2> id850qb disk (software tools for debugging are packaged.) <3> device file note 1 <4> usb interface cable (supplied with <5>) <5> on-chip debug emulator (qb-v850mini) <6> ocd cable (supplied with <5>) <7> kel adapter (supplied with <5>) notes 2, 3 <8> kel connector (supplied with <5>) notes 2, 3 <9> 2.54 mm pitch 20-pin general-purpose connector (sold separately) note 3 notes 1. obtain the device file from the nec electronics website. http://www.necel.com/micro/ods/eng/index.html 2. product of kel corporation 3. a connector other than kel connectors can also be us ed as the target connector. for details, refer to the qb-v850mini user?s manual .
appendix a development tools user?s manual u16603ej5v1ud 1142 a.5 debugging tools (software) this is a system simulator for the v850 microcontrollers. the sm+ are windows-based softwares. it is used to perform debugging at the c source level or assembler level while simulating the operation of the target system on a host machine. use of the sm+ allows the execution of application logical testing and performance testing on an independent basis from hardware development, thereby providing higher development efficiency and software quality. the sm850 and sm+ should be used in combination with the device file (sold separately). sm+ for v850es/sx2 system simulator part number: s sm703289-b id850 integrated debugger (supporting in-circuit emulator ie-v850es-g1) this debugger supports the in-circuit emulat ors for the v850 microcontrollers. the id850 and id850qb are windows-based software. it has improved c-compatible debugging functions and can display the results of tracing with the source program using an integrating window function that associates the source program, disassemble display, and memo ry display with the trace result. it should be used in combination with the device file (sold separately). id850qb integrated debugger (supporting in-circuit emulator qb-v850essx2) part number: s id703000, s id703000-gc (id850) remark in the part number differs depending on the os used. s sm703289-b s id703000 s id703000-gc host machine os supply medium ab17 windows (japanese version) bb17 pc-9800 series, ibm pc/at compatibles windows (english version) cd-rom
appendix a development tools user?s manual u16603ej5v1ud 1143 a.6 embedded software the rx850 and rx850 pro are real-time oss conforming to itron 3.0 specifications. a tool (configurator) for generating multiple information tables is supplied. rx850 pro has more functions than rx850. rx850, rx850 pro real-time os part number: s rx703000- ??? (rx850) s rx703100- ??? (rx850 pro) v850mini-net (provisional name) (network library) this is a network library conforming to rfc. it is a lightweight tcp/ip of compact design, requiring only a small memory. in addition to the tcp/ip standard set, an http server, smtp client , and pop client are also supported. rx-fs850 (file system) this is a fat file system function. it is a file system that supports the cd-rom file system function. this file system is used with the real-time os rx850 pro. caution to purchase the rx850 or rx850 pro, first fill in the purchase applicati on form and sign the user agreement. remark and ??? in the part number differ depending on the host machine and os used. s rx703000- ??? s rx703100- ??? ??? product outline maximum number for use in mass production 001 evaluation object do not use for mass-produced product. 100k 0.1 million units 001m 1 million units 010m mass-production object 10 million units s01 source program object source program for mass production host machine os supply medium ab17 windows (japanese version) bb17 pc-9800 series, ibm pc/at compatibles windows (english version) 3k17 sparcstation solaris (rel. 2.5.1) cd-rom a.7 flash memory writing tools flashpro iv (part number: pg-fp4) flash memory programmer flashpro v (part number: pg-fp5) flash memory programmer flash memory programmer dedica ted to microcontrollers with on-chip flash memory. fa-144gj-uen-a flash memory writing adapter flash memory writing adapter used conne cted to flashpro iv or flashpro v. ? fa-144gj-uen-a: for 144-pi n plastic lqfp (gj-uen type) remark fa-144gj-uen-a is a product of na ito densei machida mfg. co., ltd. tel: +81-42-750-4172 naito densei machida mfg. co., ltd.
user?s manual u16603ej5v1ud 1144 appendix b major differences be tween v850es/sj2 and v850es/sj2-h differences between the v850es/sj2 and v850es/sj2-h are shown below. for details, refer to each corresponding section. for each part numbers of t he v850es/sj2 and v850es/sj2-h, refer to remark of table 1-1 . table b-1. major differences betw een v850es/sj2 and v850es/sj2-h (1/2) major differences v850es/sj2 v850es/sj2-h refer to: minimum instruction execution time 50 ns 31.25 ns 1.2 internal flash memory 384/640 kb 640 kb internal rom 384/512/640 kb 512/640 kb 3.4.4 (1) internal ram 32/40/48 kb 40/48 kb 3.4.4 (2) special register psc, ckc, pcc, clm, resf, lvim, rams, ocdm registers psc, ckc, pcc, clm, resf, rams, ocdm registers 3.4.8 cpu function set value of vswc 00h/01h 00h/01h/11h 3.4.9 (1) (a) number of access clock instruction fetch (branch) of internal rom (32-bit): 2 operand data access of internal rom (32-bit): 3 instruction fetch (branch) of internal rom (32-bit): 3 operand data access of internal rom (32-bit): 4 5.5.1 dwc0 register: cautions on data wait none provided 5.6.1 (1) bus control function awc register: cautions on address hold wait, address setup wait none provided 5.6.4 (1) clock through mode f x = 2.5 to 10 mhz (f xx = 2.5 to 10 mhz) f x = 2.5 to 8 mhz (f xx = 2.5 to 8 mhz) main clock oscillation frequency pll mode f x = 2.5 to 5 mhz (f xx = 10 to 20 mhz) f x = 2.5 to 5 mhz ( 4: f xx = 10 to 20 mhz) f x = 2.5 to 4 mhz ( 8: f xx = 20 to 32 mhz) 6.1 a/d converter: ada0m1.ada0fr3 bit none provided 13.4 (2) iebus controller: clock f xx , f xx /2, f xx /3 f xx , f xx /2, f xx /3, f xx /4, f xx /5 18.3 (17) dma function: dtfrn register the procedure to change the setting differs. 20.3 (6) number of maskable interrupts 60/64/68 59/63/67 22.1 restriction for xxicn register none provided 22.3.4 interrupt interrupt response time (internal interrupt (maximum)) 6 7 22.7
appendix b major differences between v850es/sj2 and v850es/sj2 user?s manual u16603ej5v1ud 1145 table b-1. major differences betw een v850es/sj2 and v850es/sj2-h (2/2) major differences v850es/sj2 v850es/sj2-h refer to: resf.lvirf bit provided none 25.2 (1) reset by low-voltage detector provided none 25.3.3 reset function firmware operation time (sec.) 14,974 (1/f x ) 11,994 (1/f x ) 25.3.5 (2) low-voltage detector provided none chapter 27 block configuration internal flash memory: 384/640 kb blocks 0 to 3: 28 kb each blocks 4 to 7: 4 kb each block 8 to last block: 64 kb each internal flash memory: 640 kb blocks 0, 2: 56 kb each blocks 1, 3: 8 kb each blocks 4 to 7: 128 kb each flash memory boot area 56 kb 64 kb 30.2 operating condition when using main clock (adc, dac stopped), sub clock (adc, dac stopped): v dd = ev dd = av ref0 = av ref1 = 2.85 to 3.6 v bv dd = 2.7 to 3.6 v when using main clock (adc, dac operating): v dd = ev dd = av ref0 = av ref1 = 3.0 to 3.6 v bv dd = 2.7 to 3.6 v when using main clock, subclock: v dd = ev dd = bv dd = av ref0 = av ref1 = 3.0 to 3.6 v 32.3 main clock oscillator characteristics oscillator frequency (f x ) = 10 mhz (max.) oscillator frequency (f x ) = 8 mhz (max.) 32.4.1 using input frequency, 8 mode f x = 2.5 mhz (max.) using input frequency, 8 mode f x = 4 mhz (max.) pll characteristics using output frequency, 8 mode f xx = 20 mhz (max.) using output frequency, 8 mode f xx = 32 mhz (max.) 32.4.3 regulator characteristics (input voltage (v dd )) v dd = 2.85 to 3.6 v v dd = 3.0 to 3.6 v 32.5 dc characteristics (supply current) the value of each parameter differs. 32.6.2 clkout output timing (output cycle) 50 ns (min.) 31.25 ns (min.) 32.8.1 bus timing the value of some parameters differs. 32.8.2 csib timing (slave mode) delay time from sckbn to sobn output (t kso2 ): 30 ns (max.) delay time from sckbn to sobn output (t kso2 ): 35 ns (max.) 32.9 (6) (b) lvi circuit characteristics provided none 32.9 (12) flash memory programming characteristics (basic characteristics, operating frequency) f cpu = 2.5 to 20 mhz f cpu = 2.5 to 32 mhz flash memory programming characteristics (basic characteristics, supply voltage) v dd = 2.85 to 3.6 v v dd = 3.0 to 3.6 v 32.10 (1) electrical specifications flash memory programming characteristics (programming specification) the value of each parameter differs. 32.10 (3)
user?s manual u16603ej5v1ud 1146 appendix c register index (1/16) symbol name unit page ada0cr0 a/d conversion result register 0 adc 488 ada0cr0h a/d conversion result register 0h adc 488 ada0cr1 a/d conversion result register 1 adc 488 ada0cr1h a/d conversion result register 1h adc 488 ada0cr2 a/d conversion result register 2 adc 488 ada0cr2h a/d conversion result register 2h adc 488 ada0cr3 a/d conversion result register 3 adc 488 ada0cr3h a/d conversion result register 3h adc 488 ada0cr4 a/d conversion result register 4 adc 488 ada0cr4h a/d conversion result register 4h adc 488 ada0cr5 a/d conversion result register 5 adc 488 ada0cr5h a/d conversion result register 5h adc 488 ada0cr6 a/d conversion result register 6 adc 488 ada0cr6h a/d conversion result register 6h adc 488 ada0cr7 a/d conversion result register 7 adc 488 ada0cr7h a/d conversion result register 7h adc 488 ada0cr8 a/d conversion result register 8 adc 488 ada0cr8h a/d conversion result register 8h adc 488 ada0cr9 a/d conversion result register 9 adc 488 ada0cr9h a/d conversion result register 9h adc 488 ada0cr10 a/d conversion result register 10 adc 488 ada0cr10h a/d conversion result register 10h adc 488 ada0cr11 a/d conversion result register 11 adc 488 ada0cr11h a/d conversion result register 11h adc 488 ada0cr12 a/d conversion result register 12 adc 488 ada0cr12h a/d conversion result register 12h adc 488 ada0cr13 a/d conversion result register 13 adc 488 ada0cr13h a/d conversion result register 13h adc 488 ada0cr14 a/d conversion result register 14 adc 488 ada0cr14h a/d conversion result register 14h adc 488 ada0cr15 a/d conversion result register 15 adc 488 ada0cr15h a/d conversion result register 15h adc 488 ada0m0 a/d converter mode register 0 adc 481 ada0m1 a/d converter mode register 1 adc 483 ada0m2 a/d converter mode register 2 adc 486 ada0pfm power fail comparison mode register adc 490 ada0pft power fail comparison threshold value register adc 491 ada0s a/d converter channel specify register adc 487 adic interrupt control register intc 968 awc address wait control register bcu 216 bcc bus cycle control register bcu 217
appendix c register index user?s manual u16603ej5v1ud 1147 (2/16) symbol name unit page bcr iebus control register iebus 708 bpc peripheral i/o area select control register bcu 90 bsc bus size configuration register bcu 205 c0brp can0 module bit rate prescaler register can 840 c0btr can0 bit rate register can 841 c0ctrl can0 module control register can 830 c0erc can0 module error counter register can 836 c0gmabt can0 global automatic block transmit control register can 825 c0gmabtd can0 global automatic block tr ansmit delay setting register can 827 c0gmcs can0 global clock select register can 824 c0gmctrl can0 global control register can 822 c0ie can0 module interrupt enable register can 837 c0info can0 module information register can 835 c0ints can0 module interrupt status register can 839 c0lec can0 module last error information register can 834 c0lipt can0 module last rece ive pointer register can 843 c0lopt can0 module last transmit pointer register can 845 c0mask1h can0 module mask 1 register h can 828 c0mask1l can0 module mask 1 register l can 828 c0mask2h can0 module mask 2 register h can 828 c0mask2l can0 module mask 2 register l can 828 c0mask3h can0 module mask 3 register h can 828 c0mask3l can0 module mask 3 register l can 828 c0mask4h can0 module mask 4 register h can 828 c0mask4l can0 module mask 4 register l can 828 c0mconfm can0 massage configuration register m can 852 c0mctrlm can0 message control register m can 854 c0mdata01m can0 massage data byte 01 register m can 849 c0mdata0m can0 massage data byte 0 register m can 849 c0mdata1m can0 massage data byte 1 register m can 849 c0mdata23m can0 massage data byte 23 register m can 849 c0mdata2m can0 massage data byte 2 register m can 849 c0mdata3m can0 massage data byte 3 register m can 849 c0mdata45m can0 massage data byte 45 register m can 849 c0mdata4m can0 massage data byte 4 register m can 849 c0mdata5m can0 massage data byte 5 register m can 849 c0mdata67m can0 massage data byte 67 register m can 849 c0mdata6m can0 massage data byte 6 register m can 849 c0mdata7m can0 massage data byte 7 register m can 849 c0mdlcm can0 message data length register m can 851 c0midhm can0 message id register mh can 853 c0midlm can0 message id register ml can 853 remark m = 00 to 31
appendix c register index user?s manual u16603ej5v1ud 1148 (3/16) symbol name unit page c0rgpt can0 module receive history list register can 844 c0tgpt can0 module transmit history list register can 846 c0ts can0 module time stamp register can 847 c1brp can1 module bit rate prescaler register can 840 c1btr can1 bit rate register can 841 c1ctrl can1 module control register can 830 c1erc can1 module error counter register can 836 c1gmabt can1 global automatic block transmit control register can 825 c1gmabtd can1 global automatic block tr ansmit delay setting register can 827 c1gmcs can1 global clock select register can 824 c1gmctrl can1 global control register can 822 c1ie can1 module interrupt enable register can 837 c1info can1 module information register can 835 c1ints can1 module interrupt status register can 839 c1lec can1 module last error information register can 834 c1lipt can1 module last rece ive pointer register can 843 c1lopt can1 module last transmit pointer register can 845 c1mask1h can1 module mask 1 register h can 828 c1mask1l can1 module mask 1 register l can 828 c1mask2h can1 module mask 2 register h can 828 c1mask2l can1 module mask 2 register l can 828 c1mask3h can1 module mask 3 register h can 828 c1mask3l can1 module mask 3 register l can 828 c1mask4h can1 module mask 4 register h can 828 c1mask4l can1 module mask 4 register l can 828 c1mconfm can1 massage configuration register m can 852 c1mctrlm can1 message control register m can 854 c1mdata01m can1 massage data byte 01 register m can 849 c1mdata0m can1 massage data byte 0 register m can 849 c1mdata1m can1 massage data byte 1 register m can 849 c1mdata23m can1 massage data byte 23 register m can 849 c1mdata2m can1 massage data byte 2 register m can 849 c1mdata3m can1 massage data byte 3 register m can 849 c1mdata45m can1 massage data byte 45 register m can 849 c1mdata4m can1 massage data byte 4 register m can 849 c1mdata5m can1 massage data byte 5 register m can 849 c1mdata67m can1 massage data byte 67 register m can 849 c1mdata6m can1 massage data byte 6 register m can 849 c1mdata7m can1 massage data byte 7 register m can 849 c1mdlcm can1 message data length register m can 851 c1midhm can1 message id register mh can 853 c1midlm can1 message id register ml can 853 remark m = 00 to 31
appendix c register index user?s manual u16603ej5v1ud 1149 (4/16) symbol name unit page c1rgpt can1 module receive history list register can 844 c1tgpt can1 module transmit history list register can 846 c1ts can1 module time stamp register can 847 cb0ctl0 csib0 control register 0 csib 562 cb0ctl1 csib0 control register 1 csib 566 cb0ctl2 csib0 control register 2 csib 567 cb0ric interrupt control register intc 968 cb0rx csib0 receive data register csib 561 cb0rxl csib0 receive data register l csib 561 cb0str csib0 status register csib 569 cb0tic interrupt control register intc 968 cb0tx csib0 transmit data register csi 561 cb0txl csib0 transmit data register l csi 561 cb1ctl0 csib1 control register 0 csi 562 cb1ctl1 csib1 control register 1 csi 566 cb1ctl2 csib1 control register 2 csi 567 cb1ric interrupt control register intc 968 cb1rx csib1 receive data register csi 561 cb1rxl csib1 receive data register l csi 561 cb1str csib1 status register csi 569 cb1tic interrupt control register intc 968 cb1tx csib1 transmit data register csi 561 cb1txl csib1 transmit data register l csi 561 cb2ctl0 csib2 control register 0 csi 562 cb2ctl1 csib2 control register 1 csi 566 cb2ctl2 csib2 control register 2 csi 567 cb2ric interrupt control register intc 968 cb2rx csib2 receive data register csi 561 cb2rxl csib2 receive data register l csi 561 cb2str csib2 status register csi 569 cb2tic interrupt control register intc 968 cb2tx csib2 transmit data register csi 561 cb2txl csib2 transmit data register l csi 561 cb3ctl0 csib3 control register 0 csi 562 cb3ctl1 csib3 control register 1 csi 566 cb3ctl2 csib3 control register 2 csi 567 cb3ric interrupt control register intc 968 cb3rx csib3 receive data register csi 561 cb3rxl csib3 receive data register l csi 561 cb3str csib3 status register csi 569 cb3tic interrupt control register intc 968 cb3tx csib3 transmit data register csi 561 cb3txl csib3 transmit data register l csi 561
appendix c register index user?s manual u16603ej5v1ud 1150 (5/16) symbol name unit page cb4ctl0 csib4 control register 0 csi 562 cb4ctl1 csib4 control register 1 csi 566 cb4ctl2 csib4 control register 2 csi 567 cb4ric interrupt control register intc 968 cb4rx csib4 receive data register csi 561 cb4rxl csib4 receive data register l csi 561 cb4str csib4 status register csi 569 cb4tic interrupt control register intc 968 cb4tx csib4 transmit data register csi 561 cb4txl csib4 transmit data register l csi 561 cb5ctl0 csib5 control register 0 csi 562 cb5ctl1 csib5 control register 1 csi 566 cb5ctl2 csib5 control register 2 csi 567 cb5ric interrupt control register intc 968 cb5rx csib5 receive data register csi 561 cb5rxl csib5 receive data register l csi 561 cb5str csib5 status register csi 569 cb5tic interrupt control register intc 968 cb5tx csib5 transmit data register csi 561 cb5txl csib5 transmit data register l csi 561 ccls cpu operation clock status register cg 234 ccr iebus communication count register iebus 734 cdr iebus control data register iebus 725 ckc clock control register cg 237 clm clock monitor mode register clm 1032 corad0 correction address register 0 romc 1046 corad0h correction address register 0h romc 1046 corad0l correction address register 0l romc 1046 corad1 correction address register 1 romc 1046 corad1h correction address register 1h romc 1046 corad1l correction address register 1l romc 1046 corad2 correction address register 2 romc 1046 corad2h correction address register 2h romc 1046 corad2l correction address register 2l romc 1046 corad3 correction address register 3 romc 1046 corad3h correction address register 3h romc 1046 corad3l correction address register 3l romc 1046 corcn correction control register romc 1047 crcd crc data register crc 947 crcin crc input register crc 947 ctbp callt base pointer cpu 63 ctpc callt execution status saving register cpu 62 ctpsw callt execution status saving register cpu 62
appendix c register index user?s manual u16603ej5v1ud 1151 (6/16) symbol name unit page da0cs0 d/a converter value setting register 0 dac 516 da0cs1 d/a converter value setting register 1 dac 516 da0m d/a converter mode register dac 516 dadc0 dma addressing control register 0 dmac 927 dadc1 dma addressing control register 1 dmac 927 dadc2 dma addressing control register 2 dmac 927 dadc3 dma addressing control register 3 dmac 927 dbc0 dma transfer count register 0 dmac 926 dbc1 dma transfer count register 1 dmac 926 dbc2 dma transfer count register 2 dmac 926 dbc3 dma transfer count register 3 dmac 926 dbpc exception/debug trap status saving register cpu 63 dbpsw exception/debug trap status saving register cpu 63 dchc0 dma channel control register 0 dmac 928 dchc1 dma channel control register 1 dmac 928 dchc2 dma channel control register 2 dmac 928 dchc3 dma channel control register 3 dmac 928 dda0h dma destination address register 0h dmac 925 dda0l dma destination address register 0l dmac 925 dda1h dma destination address register 1h dmac 925 dda1l dma destination address register 1l dmac 925 dda2h dma destination address register 2h dmac 925 dda2l dma destination address register 2l dmac 925 dda3h dma destination address register 3h dmac 925 dda3l dma destination address register 3l dmac 925 dlr iebus telegraph length register iebus 730 dmaic0 interrupt control register intc 968 dmaic1 interrupt control register intc 968 dmaic2 interrupt control register intc 968 dmaic3 interrupt control register intc 968 dr iebus data register iebus 731 dsa0h dma source address register 0h dmac 924 dsa0l dma source address register 0l dmac 924 dsa1h dma source address register 1h dmac 924 dsa1l dma source address register 1l dmac 924 dsa2h dma source address register 2h dmac 924 dsa2l dma source address register 2l dmac 924 dsa3h dma source address register 3h dmac 924 dsa3l dma source address register 3l dmac 924 dtfr0 dma trigger source register 0 dmac 929 dtfr1 dma trigger source register 1 dmac 929 dtfr2 dma trigger source register 2 dmac 929 dtfr3 dma trigger source register 3 dmac 929
appendix c register index user?s manual u16603ej5v1ud 1152 (7/16) symbol name unit page dwc0 data wait control register 0 bcu 213 ecr interrupt source register cpu 60 eipc interrupt status saving register cpu 59 eipsw interrupt status saving register cpu 59 erric interrupt control register intc 968 erric0 interrupt control register intc 968 erric1 interrupt control register intc 968 esr iebus error status register iebus 719 eximc external bus interface mode control register bcu 203 fepc nmi status saving register cpu 60 fepsw nmi status saving register cpu 60 fsr iebus field status register iebus 732 ieic1 interrupt control register intc 968 ieic2 interrupt control register intc 968 iic0 iic shift register 0 i 2 c 630 iic1 iic shift register 1 i 2 c 630 iic2 iic shift register 2 i 2 c 630 iicc0 iic control register 0 i 2 c 616 iicc1 iic control register 1 i 2 c 616 iicc2 iic control register 2 i 2 c 616 iiccl0 iic clock select register 0 i 2 c 626 iiccl1 iic clock select register 1 i 2 c 626 iiccl2 iic clock select register 2 i 2 c 626 iicf0 iic flag register 0 i 2 c 624 iicf1 iic flag register 1 i 2 c 624 iicf2 iic flag register 2 i 2 c 624 iicic0 interrupt control register intc 968 iicic1 interrupt control register intc 968 iicic2 interrupt control register intc 968 iics0 iic status register 0 i 2 c 621 iics1 iic status register 1 i 2 c 621 iics2 iic status register 2 i 2 c 621 iicx0 iic function extension register 0 i 2 c 627 iicx1 iic function extension register 1 i 2 c 627 iicx2 iic function extension register 2 i 2 c 627 imr0 interrupt mask register 0 intc 972 imr0h interrupt mask register 0h intc 972 imr0l interrupt mask register 0l intc 972 imr1 interrupt mask register 1 intc 972 imr1h interrupt mask register 1h intc 972 imr1l interrupt mask register 1l intc 972 imr2 interrupt mask register 2 intc 972 imr2h interrupt mask register 2h intc 972
appendix c register index user?s manual u16603ej5v1ud 1153 (8/16) symbol name unit page imr2l interrupt mask register 2l intc 972 imr3 interrupt mask register 3 intc 972 imr3h interrupt mask register 3h intc 972 imr3l interrupt mask register 3l intc 972 imr4 interrupt mask register 4 intc 972 imr4h interrupt mask register 4h intc 972 imr4l interrupt mask register 4l intc 972 intf0 external interrupt falling edge specification register 0 intc 984 intf3 external interrupt falling edge specification register 3 intc 985 intf8 external interrupt falling edge specification register 8 intc 986 intf9h external interrupt falling edge specification register 9h intc 987 intr0 external interrupt rising edge specification register 0 intc 984 intr3 external interrupt rising edge specification register 3 intc 985 intr8 external interrupt rising edge specification register 8 intc 986 intr9h external interrupt rising edge specification register 9h intc 987 ispr in-service priority register intc 974 isr iebus interrupt status register iebus 717 kric interrupt control register intc 968 krm key return mode register kr 994 lockr lock register cg 238 lviic interrupt control register intc 968 lvim low voltage detection register lvi 1037 lvis low voltage detection level select register lvi 1038 nfc noise elimination control register intc 988 ocdm on-chip debug mode register debug 1080 ocks0 iic divided clock select register 0 i 2 c 630 ocks1 iic divided clock select register 1 i 2 c 630 ocks2 iebus clock select register iebus 735 osts oscillation stabilization time select register standby 999 p0 port 0 register port 104 p1 port 1 register port 107 p3 port 3 register port 108 p3h port 3 register h port 108 p3l port 3 register l port 108 p4 port 4 register port 114 p5 port 5 register port 117 p6 port 6 register port 122 p6h port 6 register h port 122 p6l port 6 register l port 122 p7h port 7 register h port 126 p7l port 7 register l port 126 p8 port 8 register port 127 p9 port 9 register port 130
appendix c register index user?s manual u16603ej5v1ud 1154 (9/16) symbol name unit page p9h port 9 register h port 130 p9l port 9 register l port 130 par iebus partner address register iebus 724 pc program counter cpu 57 pcc processor clock control register cg 230 pcd port cd register port 137 pcm port cm register port 138 pcs port cs register port 140 pct port ct register port 142 pdh port dh register port 144 pdl port dl register port 146 pdlh port dl register h port 146 pdll port dl register l port 146 pemu1 peripheral emulat ion register 1 cpu 1042 pf0 port 0 function register port 106 pf3 port 3 function register port 113 pf3h port 3 function register h port 113 pf3l port 3 function register l port 113 pf4 port 4 function register port 116 pf5 port 5 function register port 120 pf6 port 6 function register port 124 pf6h port 6 function register h port 124 pf6l port 6 function register l port 124 pf8 port 8 function register port 128 pf9 port 9 function register port 136 pf9h port 9 function register h port 136 pf9l port 9 function register l port 136 pfc0 port 0 function control register port 106 pfc3 port 3 function control register port 111 pfc3h port 3 function control register h port 111 pfc3l port 3 function control register l port 111 pfc4 port 4 function control register port 115 pfc5 port 5 function control register port 119 pfc6h port 6 function control register h port 124 pfc9 port 9 function control register port 133 pfc9h port 9 function control register h port 133 pfc9l port 9 function control register l port 133 pfce3l port 3 function control extension register l port 111 pfce5 port 5 function control extension register port 119 pfce9 port 9 function control extension register port 133 pfce9h port 9 function control extension register h port 133 pfce9l port 9 function control extension register l port 133 pic0 interrupt control register intc 968
appendix c register index user?s manual u16603ej5v1ud 1155 (10/16) symbol name unit page pic1 interrupt control register intc 968 pic2 interrupt control register intc 968 pic3 interrupt control register intc 968 pic4 interrupt control register intc 968 pic5 interrupt control register intc 968 pic6 interrupt control register intc 968 pic7 interrupt control register intc 968 pic8 interrupt control register intc 968 pllctl pll control register cg 236 plls pll lockup time specification register cg 239 pm0 port 0 mode register port 105 pm1 port 1 mode register port 107 pm3 port 3 mode register port 109 pm3h port 3 mode register h port 109 pm3l port 3 mode register l port 109 pm4 port 4 mode register port 114 pm5 port 5 mode register port 118 pm6 port 6 mode register port 122 pm6h port 6 mode register h port 122 pm6l port 6 mode register l port 122 pm7h port 7 mode register h port 126 pm7l port 7 mode register l port 126 pm8 port 8 mode register port 127 pm9 port 9 mode register port 130 pm9h port 9 mode register h port 130 pm9l port 9 mode register l port 130 pmc0 port 0 mode control register port 105 pmc3 port 3 mode control register port 109 pmc3h port 3 mode control register h port 109 pmc3l port 3 mode control register l port 109 pmc4 port 4 mode control register port 115 pmc5 port 5 mode control register port 118 pmc6 port 6 mode control register port 123 pmc6h port 6 mode control register h port 123 pmc6l port 6 mode control register l port 123 pmc8 port 8 mode control register port 128 pmc9 port 9 mode control register port 131 pmc9h port 9 mode control register h port 131 pmc9l port 9 mode control register l port 131 pmccm port cm mode control register port 139 pmccs port cs mode control register port 141 pmcct port ct mode control register port 143 pmcd port cd mode register port 137
appendix c register index user?s manual u16603ej5v1ud 1156 (11/16) symbol name unit page pmcdh port dh mode control register port 145 pmcdl port dl mode control register port 147 pmcdlh port dl mode control register h port 147 pmcdll port dl mode control register l port 147 pmcm port cm mode register port 138 pmcs port cs mode register port 140 pmct port ct mode register port 142 pmdh port dh mode register port 144 pmdl port dl mode register port 147 pmdlh port dl mode register h port 147 pmdll port dl mode register l port 147 prcmd command register cpu 92 prscm0 prescaler compare register 0 wt 459 prscm1 brg1 prescaler compare register brg 606 prscm2 brg2 prescaler compare register brg 606 prscm3 brg3 prescaler compare register brg 606 prsm0 prescaler mode register 0 wt 458 prsm1 brg1 prescaler mode register brg 605 prsm2 brg2 prescaler mode register brg 605 prsm3 brg3 prescaler mode register brg 605 psc power save control register cg 997 psmr power save mode register cg 998 psr iebus power save register iebus 712 psw program status word cpu 61 r0 to r31 general-purpose registers cpu 57 rams internal ram data status register cg 1030 rcm internal oscillation mode register cg 234 recic0 interrupt control register intc 968 recic1 interrupt control register intc 968 resf reset source flag register reset 1019 rsa iebus receive slave address register iebus 725 rtbh0 real-time output buffer register 0h rtp 472 rtbh1 real-time output buffer register 1h rtp 472 rtbl0 real-time output buffer register 0l rtp 472 rtbl1 real-time output buffer register 1l rtp 472 rtpc0 real-time output port control register 0 rtp 474 rtpc1 real-time output port control register 1 rtp 474 rtpm0 real-time output port mode register 0 rtp 473 rtpm1 real-time output port mode register 1 rtp 473 sar iebus slave address register iebus 724 scr iebus success count register iebus 733 selcnt0 selector operation control register 0 timer 338 ssr iebus slave status register iebus 713
appendix c register index user?s manual u16603ej5v1ud 1157 (12/16) symbol name unit page staic interrupt control register intc 968 sva0 slave address register 0 i 2 c 631 sva1 slave address register 1 i 2 c 631 sva2 slave address register 2 i 2 c 631 sys system status register 0 cpu 93 tm0cmp0 tmm0 compare register 0 timer 448 tm0ctl0 tmm0 control register 0 timer 449 tm0eqic0 interrupt control register intc 968 tp0ccic0 interrupt control register intc 968 tp0ccic1 interrupt control register intc 968 tp0ccr0 tmp0 capture/compare register 0 timer 251 tp0ccr1 tmp0 capture/compare register 1 timer 253 tp0cnt tmp0 counter read buffer register timer 255 tp0ctl0 tmp0 control register 0 timer 244 tp0ctl1 tmp0 control register 1 timer 244 tp0ioc0 tmp0 i/o control register 0 timer 246 tp0ioc1 tmp0 i/o control register 1 timer 248 tp0ioc2 tmp0 i/o control register 2 timer 249 tp0opt0 tmp0 option register 0 timer 250 tp0ovic interrupt control register intc 968 tp1ccic0 interrupt control register intc 968 tp1ccic1 interrupt control register intc 968 tp1ccr0 tmp1 capture/compare register 0 timer 251 tp1ccr1 tmp1 capture/compare register 1 timer 253 tp1cnt tmp1 counter read buffer register timer 255 tp1ctl0 tmp1 control register 0 timer 244 tp1ctl1 tmp1 control register 1 timer 244 tp1ioc0 tmp1 i/o control register 0 timer 246 tp1ioc1 tmp1 i/o control register 1 timer 248 tp1ioc2 tmp1 i/o control register 2 timer 249 tp1opt0 tmp1 option register 0 timer 250 tp1ovic interrupt control register intc 968 tp2ccic0 interrupt control register intc 968 tp2ccic1 interrupt control register intc 968 tp2ccr0 tmp2 capture/compare register 0 timer 251 tp2ccr1 tmp2 capture/compare register 1 timer 253 tp2cnt tmp2 counter read buffer register timer 255 tp2ctl0 tmp2 control register 0 timer 244 tp2ctl1 tmp2 control register 1 timer 244 tp2ioc0 tmp2 i/o control register 0 timer 246 tp2ioc1 tmp2 i/o control register 1 timer 248 tp2ioc2 tmp2 i/o control register 2 timer 249 tp2opt0 tmp2 option register 0 timer 250
appendix c register index user?s manual u16603ej5v1ud 1158 (13/16) symbol name unit page tp2ovic interrupt control register intc 968 tp3ccic0 interrupt control register intc 968 tp3ccic1 interrupt control register intc 968 tp3ccr0 tmp3 capture/compare register 0 timer 251 tp3ccr1 tmp3 capture/compare register 1 timer 253 tp3cnt tmp3 counter read buffer register timer 255 tp3ctl0 tmp3 control register 0 timer 244 tp3ctl1 tmp3 control register 1 timer 244 tp3ioc0 tmp3 i/o control register 0 timer 246 tp3ioc1 tmp3 i/o control register 1 timer 248 tp3ioc2 tmp3 i/o control register 2 timer 249 tp3opt0 tmp3 option register 0 timer 250 tp3ovic interrupt control register intc 968 tp4ccic0 interrupt control register intc 968 tp4ccic1 interrupt control register intc 968 tp4ccr0 tmp4 capture/compare register 0 timer 251 tp4ccr1 tmp4 capture/compare register 1 timer 253 tp4cnt tmp4 counter read buffer register timer 255 tp4ctl0 tmp4 control register 0 timer 244 tp4ctl1 tmp4 control register 1 timer 244 tp4ioc0 tmp4 i/o control register 0 timer 246 tp4ioc1 tmp4 i/o control register 1 timer 248 tp4ioc2 tmp4 i/o control register 2 timer 249 tp4opt0 tmp4 option register 0 timer 250 tp4ovic interrupt control register intc 968 tp5ccic0 interrupt control register intc 968 tp5ccic1 interrupt control register intc 968 tp5ccr0 tmp5 capture/compare register 0 timer 251 tp5ccr1 tmp5 capture/compare register 1 timer 253 tp5cnt tmp5 counter read buffer register timer 255 tp5ctl0 tmp5 control register 0 timer 244 tp5ctl1 tmp5 control register 1 timer 244 tp5ioc0 tmp5 i/o control register 0 timer 246 tp5ioc1 tmp5 i/o control register 1 timer 248 tp5ioc2 tmp5 i/o control register 2 timer 249 tp5opt0 tmp5 option register 0 timer 250 tp5ovic interrupt control register intc 968 tp6ccic0 interrupt control register intc 968 tp6ccic1 interrupt control register intc 968 tp6ccr0 tmp6 capture/compare register 0 timer 251 tp6ccr1 tmp6 capture/compare register 1 timer 253 tp6cnt tmp6 counter read buffer register timer 255 tp6ctl0 tmp6 control register 0 timer 244
appendix c register index user?s manual u16603ej5v1ud 1159 (14/16) symbol name unit page tp6ctl1 tmp6 control register 1 timer 244 tp6ioc0 tmp6 i/o control register 0 timer 246 tp6ioc1 tmp6 i/o control register 1 timer 248 tp6ioc2 tmp6 i/o control register 2 timer 249 tp6opt0 tmp6 option register 0 timer 250 tp6ovic interrupt control register intc 968 tp7ccic0 interrupt control register intc 968 tp7ccic1 interrupt control register intc 968 tp7ccr0 tmp7 capture/compare register 0 timer 251 tp7ccr1 tmp7 capture/compare register 1 timer 253 tp7cnt tmp7 counter read buffer register timer 255 tp7ctl0 tmp7 control register 0 timer 244 tp7ctl1 tmp7 control register 1 timer 244 tp7ioc0 tmp7 i/o control register 0 timer 246 tp7ioc1 tmp7 i/o control register 1 timer 248 tp7ioc2 tmp7 i/o control register 2 timer 249 tp7opt0 tmp7 option register 0 timer 250 tp7ovic interrupt control register intc 968 tp8ccic0 interrupt control register intc 968 tp8ccic1 interrupt control register intc 968 tp8ccr0 tmp8 capture/compare register 0 timer 251 tp8ccr1 tmp8 capture/compare register 1 timer 253 tp8cnt tmp8 counter read buffer register timer 255 tp8ctl0 tmp8 control register 0 timer 244 tp8ctl1 tmp8 control register 1 timer 244 tp8ioc0 tmp8 i/o control register 0 timer 246 tp8ioc1 tmp8 i/o control register 1 timer 248 tp8ioc2 tmp8 i/o control register 2 timer 249 tp8opt0 tmp8 option register 0 timer 250 tp8ovic interrupt control register intc 968 tq0ccic0 interrupt control register intc 968 tq0ccic1 interrupt control register intc 968 tq0ccic2 interrupt control register intc 968 tq0ccic3 interrupt control register intc 968 tq0ccr0 tmq0 capture/compare register 0 timer 349 tq0ccr1 tmq0 capture/compare register 1 timer 351 tq0ccr2 tmq0 capture/compare register 2 timer 353 tq0ccr3 tmq0 capture/compare register 3 timer 355 tq0cnt tmq0 counter read buffer register timer 357 tq0ctl0 tmq0 control register 0 timer 343 tq0ctl1 tmq0 control register 1 timer 344 tq0ioc0 tmq0 i/o control register 0 timer 345 tq0ioc1 tmq0 i/o control register 1 timer 346
appendix c register index user?s manual u16603ej5v1ud 1160 (15/16) symbol name unit page tq0ioc2 tmq0 i/o control register 2 timer 347 tq0opt0 tmq0 option register 0 timer 348 tq0ovic interrupt control register intc 968 trxic0 interrupt control register intc 968 trxic1 interrupt control register intc 968 ua0ctl0 uarta0 control register 0 uarta 525 ua0ctl1 uarta0 control register 1 uarta 549 ua0ctl2 uarta0 control register 2 uarta 550 ua0opt0 uarta0 option control register 0 uarta 527 ua0ric interrupt control register intc 968 ua0rx uarta0 receive data register uarta 531 ua0str uarta0 status register uarta 529 ua0tic interrupt control register intc 968 ua0tx uarta0 transmit data register uarta 531 ua1ctl0 uarta1 control register 0 uarta 525 ua1ctl1 uarta1 control register 1 uarta 549 ua1ctl2 uarta1 control register 2 uarta 550 ua1opt0 uarta1 option control register 0 uarta 527 ua1ric interrupt control register intc 968 ua1rx uarta1 receive data register uarta 531 ua1str uarta1 status register uarta 529 ua1tic interrupt control register intc 968 ua1tx uarta1 transmit data register uarta 531 ua2ctl0 uarta2 control register 0 uarta 525 ua2ctl1 uarta2 control register 1 uarta 549 ua2ctl2 uarta2 control register 2 uarta 550 ua2opt0 uarta2 option control register 0 uarta 527 ua2ric interrupt control register intc 968 ua2rx uarta2 receive data register uarta 531 ua2str uarta2 status register uarta 529 ua2tic interrupt control register intc 968 ua2tx uarta2 transmit data register uarta 531 ua3ctl0 uarta3 control register 0 uarta 525 ua3ctl1 uarta3 control register 1 uarta 549 ua3ctl2 uarta3 control register 2 uarta 550 ua3opt0 uarta3 option control register 0 uarta 527 ua3ric interrupt control register intc 968 ua3rx uarta3 receive data register uarta 531 ua3str uarta3 status register uarta 529 ua3tic interrupt control register intc 968 ua3tx uarta3 transmit data register uarta 531 uar iebus unit address register iebus 724 usr iebus unit status register iebus 714
appendix c register index user?s manual u16603ej5v1ud 1161 (16/16) symbol name unit page vswc system wait control register cpu 94 wdte watchdog timer enable register wdt 469 wdtm2 watchdog timer mode register 2 wdt 467, 975 wtic interrupt control register intc 968 wtiic interrupt control register intc 968 wtm watch timer operation mode register wt 460 wupic0 interrupt control register intc 968 wupic1 interrupt control register intc 968
user?s manual u16603ej5v1ud 1162 appendix d instruction set list d.1 conventions (1) register symbols u sed to describe operands register symbol explanation reg1 general-purpose registers: used as source registers. reg2 general-purpose registers: used mainly as destination registers. also used as source register in some instructions. reg3 general-purpose registers: used mainly to store the re mainders of division result s and the higher 32 bits of multiplication results. bit#3 3-bit data for specifying the bit number immx x bit immediate data dispx x bit displacement data regid system register number vector 5-bit data that specifies the trap vector (00h to 1fh) cccc 4-bit data that shows the conditions code sp stack pointer (r3) ep element pointer (r30) listx x item register list (2) register symbols used to describe opcodes register symbol explanation r 1-bit data of a code that specifies reg1 or regid r 1-bit data of the code that specifies reg2 w 1-bit data of the code that specifies reg3 d 1-bit displacement data i 1-bit immediate data (indicates th e higher bits of immediate data) i 1-bit immediate data cccc 4-bit data that shows the condition codes cccc 4-bit data that shows the condition codes of bcond instruction bbb 3-bit data for specifying the bit number l 1-bit data that specifies a program register in the register list
appendix d instruction set list user?s manual u16603ej5v1ud 1163 (3) register symbols used in operations register symbol explanation input for gr [ ] general-purpose register sr [ ] system register zero-extend (n) expand n with zeros until word length. sign-extend (n) expand n with signs until word length. load-memory (a, b) read size b data from address a. store-memory (a, b, c) write data b into address a in size c. load-memory-bit (a, b) read bit b of address a. store-memory-bit (a, b, c) write c to bit b of address a. saturated (n) execute saturated processing of n (n is a 2?s complement). if, as a result of calculations, n 7fffffffh, let it be 7fffffffh. n 80000000h, let it be 80000000h. result reflects the results in a flag. byte byte (8 bits) halfword half word (16 bits) word word (32 bits) + addition ? subtraction ll bit concatenation multiplication division % remainder from division results and logical product or logical sum xor exclusive or not logical negation logically shift left by logical shift left logically shift right by logical shift right arithmetically shift right by arithmetic shift right (4) register symbols u sed in execution clock register symbol explanation i if executing another instruction immediately a fter executing the first instruction (issue). r if repeating execution of the same instruction immedi ately after executing the first instruction (repeat). l if using the results of instruction execution in the instruction immediately afte r the execution (latency).
appendix d instruction set list user?s manual u16603ej5v1ud 1164 (5) register symbols used in flag operations identifier explanation (blank) no change 0 clear to 0 x set or cleared in accordance with the results. r previously saved values are restored. (6) condition codes condition code (cccc) condition formula explanation 0 0 0 0 ov = 1 overflow 1 0 0 0 ov = 0 no overflow 0 0 0 1 cy = 1 carry lower (less than) 1 0 0 1 cy = 0 no carry not lower (greater than or equal) 0 0 1 0 z = 1 zero 1 0 1 0 z = 0 not zero 0 0 1 1 (cy or z) = 1 not higher (less than or equal) 1 0 1 1 (cy or z) = 0 higher (greater than) 0 1 0 0 s = 1 negative 1 1 0 0 s = 0 positive 0 1 0 1 ? always (unconditional) 1 1 0 1 sat = 1 saturated 0 1 1 0 (s xor ov) = 1 less than signed 1 1 1 0 (s xor ov) = 0 greater than or equal signed 0 1 1 1 ((s xor ov) or z) = 1 less than or equal signed 1 1 1 1 ((s xor ov) or z) = 0 greater than signed
appendix d instruction set list user?s manual u16603ej5v1ud 1165 d.2 instruction set (in alphabetical order) (1/6) execution clock flags mnemonic operand opcode operation i r l cy ov s z sat reg1,reg2 r r rr r0 01 11 0 rrrrr gr[reg2] gr[reg2]+gr[reg1] 1 1 1 add imm5,reg2 r r r r r 0 1 0 010iiiii gr[reg2] gr[reg2]+sign-extend(imm5) 1 1 1 addi imm16,reg1,reg2 r r rr r1 10 00 0 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]+sign-extend(imm16) 1 1 1 and reg1,reg2 r r rr r0 01 01 0 rrrrr gr[reg2] gr[reg2]and gr[reg1] 1 1 1 0 andi imm16,reg1,reg2 r r rr r1 10 11 0 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]and zero-extend(imm16) 1 1 1 0 when conditions are satisfied 2 note 2 note 22 2 note 2 note 22 2 note 2 note 22 bcond disp9 ddddd1011dddcccc note 1 if conditions are satisfied then pc pc+sign-extend(disp9) when conditions are not satisfied 1 1 1 bsh reg2,reg3 r r r r r 1 1 1 1 1 1 0 0 0 0 0 wwwww01101000010 gr[reg3] gr[reg2] (23 : 16) ll gr[reg2] (31 : 24) ll gr[reg2] (7 : 0) ll gr[reg2] (15 : 8) 1 1 1 0 bsw reg2,reg3 r r r r r 1 1 1 1 1 1 0 0 0 0 0 wwwww01101000000 gr[reg3] gr[reg2] (7 : 0) ll gr[reg2] (15 : 8) ll gr [reg2] (23 : 16) ll gr[reg2] (31 : 24) 1 1 1 0 callt imm6 0000001000iiiiii ctpc pc+2(return pc) ctpsw psw adr ctbp+zero-extend(imm6 logically shift left by 1) pc ctbp+zero-extend(load-memory(adr,halfword)) 4 note 22 4 note 22 4 note 22 bit#3,disp16[reg1] 10bbb111110rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) z flag not(load-memory-bit(adr,bit#3)) store-memory-bit(adr,bit#3,0) 3 note 3 3 note 3 3 note 3 clr1 reg2,[reg1] r r rr r1 11 11 1 rrrrr 0000000011100100 adr gr[reg1] z flag not(load-memory-bit(adr,reg2)) store-memory-bit(adr,reg2,0) 3 note 3 3 note 3 3 note 3 cccc,imm5,reg2,reg3 r r r r r 1 1 1 111iiiii wwwww011000cccc0 if conditions are satisfied then gr[reg3] sign-extended(imm5) else gr[reg3] gr[reg2] 1 1 1 cmov cccc,reg1,reg2,reg3 r r r r r 1 1 1 1 1 1 r r r r wwwww011001cccc0 if conditions are satisfied then gr[reg3] gr[reg1] else gr[reg3] gr[reg2] 1 1 1 reg1,reg2 r r rr r0 01 11 1 rrrrr result gr[reg2]?gr[reg1] 1 1 1 cmp imm5,reg2 r r r r r 0 1 0 011iiiii result gr[reg2]?sign-extend(imm5) 1 1 1 ctret 0000011111100000 0000000101000100 pc ctpc psw ctpsw 3 note 22 3 note 22 3 note 22 r r r r r dbret 0000011111100000 0000000101000110 pc dbpc psw dbpsw 3 note 22 3 note 22 3 note 22 r r r r r
appendix d instruction set list user?s manual u16603ej5v1ud 1166 (2/6) execution clock flags mnemonic operand opcode operation i r l cy ov s z sat dbtrap 1111100001000000 dbpc pc+2 (restored pc) dbpsw psw psw.np 1 psw.ep 1 psw.id 1 pc 00000060h 3 note 22 3 note 22 3 note 22 di 0000011111100000 0000000101100000 psw.id 1 1 1 1 imm5,list12 0000011001iiiiil lllllllllll00000 sp sp+zero-extend(imm5 logically shift left by 2) gr[reg in list12] load-memory(sp,word) sp sp+4 repeat 2 steps above until all regs in list12 is loaded n+1 note 4 n+1 note 4 n+1 note 4 dispose imm5,list12,[reg1] 0 0 0 0 0 1 1 0 0 1 i i i i i l lllllllllllrrrrr note 5 sp sp+zero-extend(imm5 logically shift left by 2) gr[reg in list12] load-memory(sp,word) sp sp+4 repeat 2 steps above until all regs in list12 is loaded pc gr[reg1] n+3 note 4 n+3 note 4 n+3 note 4 div reg1,reg2,reg3 r r rr r1 11 11 1 rrrrr wwwww01011000000 gr[reg2] gr[reg2]gr[reg1] gr[reg3] gr[reg2]%gr[reg1] 35 35 35 reg1,reg2 r r rr r0 00 01 0 rrrrr gr[reg2] gr[reg2]gr[reg1] note 6 35 35 35 divh reg1,reg2,reg3 r r rr r1 11 11 1 rrrrr wwwww01010000000 gr[reg2] gr[reg2]gr[reg1] note 6 gr[reg3] gr[reg2]%gr[reg1] 35 35 35 divhu reg1,reg2,reg3 r r rr r1 11 11 1 rrrrr wwwww01010000010 gr[reg2] gr[reg2]gr[reg1] note 6 gr[reg3] gr[reg2]%gr[reg1] 34 34 34 divu reg1,reg2,reg3 r r rr r1 11 11 1 rrrrr wwwww01011000010 gr[reg2] gr[reg2]gr[reg1] gr[reg3] gr[reg2]%gr[reg1] 34 34 34 ei 1000011111100000 0000000101100000 psw.id 0 1 1 1 halt 0000011111100000 0000000100100000 stop 1 1 1 hsw reg2,reg3 r r r r r 1 1 1 1 1 1 0 0 0 0 0 wwwww01101000100 gr[reg3] gr[reg2](15 : 0) ll gr[reg2] (31 : 16) 1 1 1 0 jarl disp22,reg2 r r r r r 1 1 1 1 0 d d d d d d ddddddddddddddd0 note 7 gr[reg2] pc+4 pc pc+sign-extend(disp22) 2 note 22 2 note 22 2 note 22 jmp [reg1] 00000000011rrrrr pc gr[reg1] 3 note 22 3 note 22 3 note 22 jr disp22 0000011110dddddd ddddddddddddddd0 note 7 pc pc+sign-extend(disp22) 2 note 22 2 note 22 2 note 22 ld.b disp16[reg1],reg2 r r rr r1 11 00 0 rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) gr[reg2] sign-extend(load-memory(adr,byte)) 1 1 note 11 ld.bu disp16[reg1],reg2 r r rr r1 11 10 b rrrrr dddddddddddddd1 notes 8, 10 adr gr[reg1]+sign-extend(disp16) gr[reg2] zero-extend(load-memory(adr,byte)) 1 1 note 11
appendix d instruction set list user?s manual u16603ej5v1ud 1167 (3/6) execution clock flags mnemonic operand opcode operation i r l cy ov s z sat ld.h disp16[reg1],reg2 rrrrr111001rrrrr ddddddddddddddd0 note 8 adr gr[reg1]+sign-extend(disp16) gr[reg2] sign-extend(load-memory(adr,halfword)) 1 1 note 11 other than regid = psw 1 1 1 ldsr reg2,regid rrrrr111111rrrrr 0000000000100000 note 12 sr[regid] gr[reg2] regid = psw 1 1 1 ld.hu disp16[reg1],reg2 r r rr r1 11 11 1 rrrrr ddddddddddddddd1 note 8 adr gr[reg1]+sign-extend(disp16) gr[reg2] zero-extend(load-memory(adr,halfword) 1 1 note 11 ld.w disp16[reg1],reg2 r r rr r1 11 00 1 rrrrr ddddddddddddddd1 note 8 adr gr[reg1]+sign-extend(disp16) gr[reg2] load-memory(adr,word) 1 1 note 11 reg1,reg2 r r rr r0 00 00 0 rrrrr gr[reg2] gr[reg1] 1 1 1 imm5,reg2 r r r r r 0 1 0 000iiiii gr[reg2] sign-extend(imm5) 1 1 1 mov imm32,reg1 00000110001rrrrr iiiiiiiiiiiiiiii iiiiiiiiiiiiiiii gr[reg1] imm32 2 2 2 movea imm16,reg1,reg2 r r rr r1 10 00 1 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]+sign-extend(imm16) 1 1 1 movhi imm16,reg1,reg2 r r rr r1 10 01 0 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]+(imm16 ll 0 16 ) 1 1 1 reg1,reg2,reg3 r r rr r1 11 11 1 rrrrr wwwww01000100000 gr[reg3] ll gr[reg2] gr[reg2]xgr[reg1] note 14 1 4 5 mul imm9,reg2,reg3 rrrrr111111iiiii wwwww01001iiii00 note 13 gr[reg3] ll gr[reg2] gr[reg2]xsign-extend(imm9) 1 4 5 reg1,reg2 r r rr r0 00 11 1 rrrrr gr[reg2] gr[reg2] note 6 xgr[reg1] note 6 1 1 2 mulh imm5,reg2 r r r r r 0 1 0 111iiiii gr[reg2] gr[reg2] note 6 xsign-extend(imm5) 1 1 2 mulhi imm16,reg1,reg2 r r rr r1 10 11 1 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1] note 6 ximm16 1 1 2 reg1,reg2,reg3 r r rr r1 11 11 1 rrrrr wwwww01000100010 gr[reg3] ll gr[reg2] gr[reg2]xgr[reg1] note 14 1 4 5 mulu imm9,reg2,reg3 rrrrr111111iiiii wwwww01001iiii10 note 13 gr[reg3] ll gr[reg2] gr[reg2]xzero-extend(imm9) 1 4 5 nop 0000000000000000 pass at least one clock cycle doing nothing. 1 1 1 not reg1,reg2 r r rr r0 00 00 1 rrrrr gr[reg2] not(gr[reg1]) 1 1 1 0 bit#3,disp16[reg1] 01bbb111110rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) z flag not(load-memory-bit(adr,bit#3)) store-memory-bit(adr,bit#3,z flag) 3 note 3 3 note 3 3 note 3 not1 reg2,[reg1] r r rr r1 11 11 1 rrrrr 0000000011100010 adr gr[reg1] z flag not(load-memory-bit(adr,reg2)) store-memory-bit(adr,reg2,z flag) 3 note 3 3 note 3 3 note 3
appendix d instruction set list user?s manual u16603ej5v1ud 1168 (4/6) execution clock flags mnemonic operand opcode operation i r l cy ov s z sat or reg1,reg2 r r rr r0 01 00 0 rrrrr gr[reg2] gr[reg2]or gr[reg1] 1 1 1 0 ori imm16,reg1,reg2 r r rr r1 10 10 0 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]or zero-extend(imm16) 1 1 1 0 list12,imm5 0000011110iiiiil lllllllllll00001 store-memory(sp?4,gr[reg in list12],word) sp sp?4 repeat 1 step above until all regs in list12 is stored sp sp-zero-extend(imm5) n+1 note 4 n+1 note 4 n+1 note 4 prepare list12,imm5, sp/imm note 15 0000011110iiiiil lllllllllllff011 imm16/imm32 note 16 store-memory(sp?4,gr[reg in list12],word) sp sp+4 repeat 1 step above until all regs in list12 is stored sp sp-zero-extend (imm5) ep sp/imm n+2 note 4 note 17 n+2 note 4 note 17 n+2 note 4 note 17 reti 0000011111100000 0000000101000000 if psw.ep=1 then pc eipc psw eipsw else if psw.np=1 then pc fepc psw fepsw else pc eipc psw eipsw 3 note 22 3 note 22 3 note 22 r r r r r reg1,reg2 r r rr r1 11 11 1 rrrrr 0000000010100000 gr[reg2] gr[reg2]arithmetically shift right by gr[reg1] 1 1 1 0 sar imm5,reg2 rrrrr010101iiiii gr[reg2] gr[reg2]arithmetically shift right by zero-extend (imm5) 1 1 1 0 sasf cccc,reg2 rrrrr1111110cccc 0000001000000000 if conditions are satisfied then gr[reg2] (gr[reg2]logically shift left by 1) or 00000001h else gr[reg2] (gr[reg2]logically shift left by 1) or 00000000h 1 1 1 reg1,reg2 r r rr r0 00 11 0 rrrrr gr[reg2] saturated(gr[reg2]+gr[reg1]) 1 1 1 satadd imm5,reg2 rrrrr010001iiiii gr[reg2] saturated(gr[reg2]+sign-extend(imm5) 1 1 1 satsub reg1,reg2 r r rr r0 00 10 1 rrrrr gr[reg2] saturated(gr[reg2]?gr[reg1]) 1 1 1 satsubi imm16,reg1,reg2 r r rr r1 10 01 1 rrrrr iiiiiiiiiiiiiiii gr[reg2] saturated(gr[reg1]?sign-extend(imm16) 1 1 1 satsubr reg1,reg2 r r rr r0 00 10 0 rrrrr gr[reg2] saturated(gr[reg1]?gr[reg2]) 1 1 1 setf cccc,reg2 rrrrr1111110cccc 0000000000000000 if conditions are satisfied then gr[reg2] 00000001h else gr[reg2] 00000000h 1 1 1
appendix d instruction set list user?s manual u16603ej5v1ud 1169 (5/6) execution clock flags mnemonic operand opcode operation i r l cy ov s z sat bit#3,disp16[reg1] 00bbb111110rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) z flag not (load-memory-bit(adr,bit#3)) store-memory-bit(adr,bit#3,1) 3 note 3 3 note 3 3 note 3 set1 reg2,[reg1] r r rr r1 11 11 1 rrrrr 0000000011100000 adr gr[reg1] z flag not(load-memory-bit(adr,reg2)) store-memory-bit(adr,reg2,1) 3 note 3 3 note 3 3 note 3 reg1,reg2 r r rr r1 11 11 1 rrrrr 0000000011000000 gr[reg2] gr[reg2] logically shift left by gr[reg1] 1 1 1 0 shl imm5,reg2 rrrrr010110iiiii gr[reg2] gr[reg2] logically shift left by zero-extend(imm5) 1 1 1 0 reg1,reg2 r r rr r1 11 11 1 rrrrr 0000000010000000 gr[reg2] gr[reg2] logically shift right by gr[reg1] 1 1 1 0 shr imm5,reg2 rrrrr010100iiiii gr[reg2] gr[reg2] logically shift right by zero-extend(imm5) 1 1 1 0 sld.b disp7[ep],reg2 r r r r r 0 1 1 0 d d d d d d d adr ep+zero-extend(disp7) gr[reg2] sign-extend(load-memory(adr,byte)) 1 1 note 9 sld.bu disp4[ep],reg2 rrrrr0000110dddd note 18 adr ep+zero-extend(disp4) gr[reg2] zero-extend(load-memory(adr,byte)) 1 1 note 9 sld.h disp8[ep],reg2 r r r r r 1 0 0 0 d d d d d d d note 19 adr ep+zero-extend(disp8) gr[reg2] sign-extend(load-memory(adr,halfword)) 1 1 note 9 sld.hu disp5[ep],reg2 rrrrr0000111dddd notes 18, 20 adr ep+zero-extend(disp5) gr[reg2] zero-extend(load-memory(adr,halfword)) 1 1 note 9 sld.w disp8[ep],reg2 rrrrr1010dddddd0 note 21 adr ep+zero-extend(disp8) gr[reg2] load-memory(adr,word) 1 1 note 9 sst.b reg2,disp7[ep] r r r r r 0 1 1 1 d d d d d d d adr ep+zero-extend(disp7) store-memory(adr,gr[reg2],byte) 1 1 1 sst.h reg2,disp8[ep] r r r r r 1 0 0 1 d d d d d d d note 19 adr ep+zero-extend(disp8) store-memory(adr,gr[reg2],halfword) 1 1 1 sst.w reg2,disp8[ep] rrrrr1010dddddd1 note 21 adr ep+zero-extend(disp8) store-memory(adr,gr[reg2],word) 1 1 1 st.b reg2,disp16[reg1] r r rr r1 11 01 0 rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) store-memory(adr,gr[reg2],byte) 1 1 1 st.h reg2,disp16[reg1] r r rr r1 11 01 1 rrrrr ddddddddddddddd0 note 8 adr gr[reg1]+sign-extend(disp16) store-memory (adr,gr[reg2], halfword) 1 1 1 st.w reg2,disp16[reg1] rrrrr111011rrrrr ddddddddddddddd1 note 8 adr gr[reg1]+sign-extend(disp16) store-memory (adr,gr[reg2], word) 1 1 1 stsr regid,reg2 r r rr r1 11 11 1 rrrrr 0000000001000000 gr[reg2] sr[regid] 1 1 1
appendix d instruction set list user?s manual u16603ej5v1ud 1170 (6/6) execution clock flags mnemonic operand opcode operation i r l cy ov s z sat sub reg1,reg2 r r rr r0 01 10 1 rrrrr gr[reg2] gr[reg2]?gr[reg1] 1 1 1 subr reg1,reg2 r r rr r0 01 10 0 rrrrr gr[reg2] gr[reg1]?gr[reg2] 1 1 1 switch reg1 00000000010rrrrr adr (pc+2) + (gr [reg1] logically shift left by 1) pc (pc+2) + (sign-extend (load-memory (adr,halfword)) logically shift left by 1 5 5 5 sxb reg1 00000000101rrrrr gr[reg1] sign-extend (gr[reg1] (7 : 0)) 1 1 1 sxh reg1 00000000111rrrrr gr[reg1] sign-extend (gr[reg1] (15 : 0)) 1 1 1 trap vector 00000111111iiiii 0000000100000000 eipc pc+4 (restored pc) eipsw psw ecr.eicc interrupt code psw.ep 1 psw.id 1 pc 00000040h (when vector is 00h to 0fh) 00000050h (when vector is 10h to 1fh) 3 note 22 3 note 22 3 note 22 tst reg1,reg2 r r rr r0 01 01 1 rrrrr result gr[reg2] and gr[reg1] 1 1 1 0 bit#3,disp16[reg1] 11bbb111110rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) z flag not (load-memory-bit (adr,bit#3)) 3 note 3 3 note 3 3 note 3 tst1 reg2, [reg1] r r rr r1 11 11 1 rrrrr 0000000011100110 adr gr[reg1] z flag not (load-memory-bit (adr,reg2)) 3 note 3 3 note 3 3 note 3 xor reg1,reg2 r r rr r0 01 00 1 rrrrr gr[reg2] gr[reg2] xor gr[reg1] 1 1 1 0 xori imm16,reg1,reg2 r r rr r1 10 10 1 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1] xor zero-extend (imm16) 1 1 1 0 zxb reg1 00000000100rrrrr gr[reg1] zero-extend (gr[reg1] (7 : 0)) 1 1 1 zxh reg1 00000000110rrrrr gr[reg1] zero-extend (gr[reg1] (15 : 0)) 1 1 1 notes 1. dddddddd: higher 8 bits of disp9. 2. 3 if there is an instruction that rewrites the contents of the psw immediately before. 3. if there is no wait state (3 + the number of read access wait states). 4. n is the total number of list12 load registers. (a ccording to the number of wait states. also, if there are no wait states, n is the total number of list12 registers. if n = 0, same operation as when n = 1) 5. rrrrr: other than 00000. 6. the lower halfword data only are valid. 7. ddddddddddddddddddddd: the higher 21 bits of disp22. 8. ddddddddddddddd: the higher 15 bits of disp16. 9. according to the number of wait stat es (1 if there are no wait states). 10. b: bit 0 of disp16. 11. according to the number of wait stat es (2 if there are no wait states).
appendix d instruction set list user?s manual u16603ej5v1ud 1171 notes 12. in this instruction, for convenience of mnemonic descr iption, the source register is made reg2, but the reg1 field is used in the opcode. therefore, the m eaning of register specific ation in the mnemonic description and in the opcode differs from other instructions. rrrrr = regid specification rrrrr = reg2 specification 13. iiiii: lower 5 bits of imm9. iiii: higher 4 bits of imm9. 14. do not specify the same register fo r general-purpose registers reg1 and reg3. 15. sp/imm: specified by bits 19 and 20 of the sub-opcode. 16. ff = 00: load sp in ep. 01: load sign expanded 16-bit immediate data (bits 47 to 32) in ep. 10: load 16-bit logically left shifted 16-bit immediate data (bits 47 to 32) in ep. 11: load 32-bit immediate data (bits 63 to 32) in ep. 17. if imm = imm32, n + 3 clocks. 18. rrrrr: other than 00 000. 19. ddddddd: higher 7 bits of disp8. 20. dddd: higher 4 bits of disp5. 21. dddddd: higher 6 bits of disp8. 22. +1 clock for the v850es/sj2-h.
user?s manual u16603ej5v1ud 1172 appendix e revision history e.1 major revisions in this edition (1/10) page description throughout ? all products are changed to lead-free products. ? addition of v850es/sj2-h p. 26 modification of description in 1.2 features p. 31 addition of note to 1.5 pin configuration (top view) p. 33 addition of description of note to 1.6.1 internal block diagram p. 38 addition of description of note to 2.1 (1) port pins p. 42 addition of description to 2.1 (2) non-port pins p. 49 modification of description in table 2-2 pin operation states in various modes pp. 50, 51 modification of description in 2.3 pin i/o circuit types, i/o buffer power supplies, and connection of unused pins p. 53 addition of description to figure 2-1 pin i/o circuits p. 54 modification of description in 2.4 (1) cautions on power application p. 54 addition of 2.4 (2) cautions on flmd0 pin p. 55 addition of description to 3.1 features p. 58 addition of note in table 3-2 system register numbers p. 63 addition of description to 3.2.2 (6) exception/debug trap status saving registers (dbpc and dbpsw) p. 64 modification of description in 3.3.1 specifying operation mode p. 73 addition of caution to 3.4.4 (3) on-chip peripheral i/o area pp. 78, 87 addition of note to 3.4.6 peripheral i/o registers p. 90 modification and addition of note to 3.4.8 special registers p. 93 modification of description in 3.4.8 (3) (a) set condition (prerr flag = 1) p. 94 addition of description to 3.4.9 (1) (a) system wait control register (vswc) pp. 95, 96 modification of description in 3.4.9 (2) accessing specific on-chip peripheral i/o registers p. 106 addition of caution to 4.3.1 (5) port 0 function register (pf0) p. 107 modification of caution in table 4-5 port 1 alternate-function pins p. 107 addition of caution to 4.3.2 (1) port 1 register (p1) p. 108 modification of caution in table 4-6 port 3 alternate-function pins p. 113 addition of caution to 4.3.3 (7) port 3 function register (pf3) p. 116 addition of caution to 4.3.4 (5) port 4 function register (pf4) p. 117 modification of caution in table 4-8 port 5 alternate-function pins p. 120 addition of caution to 4.3.5 (7) port 5 function register (pf5) p. 121 modification of caution in table 4-9 port 6 alternate-function pins p. 124 addition of caution to 4.3.6 (5) port 6 function register (pf6) p. 126 modification of description in 4.3.7 (1) port 7 register h, port 7 register l (p7h, p7l) p. 128 addition of caution to 4.3.8 (4) port 8 function register (pf8) p. 129 modification of caution in table 4-12 port 9 alternate-function pins p. 132 modification of caution in 4.3.9 (3) port 9 mode control register (pmc9) p. 133 modification of caution in 4.3.9 (4) port 9 function control register (pfc9)
appendix e revision history user?s manual u16603ej5v1ud 1173 (2/10) page description p. 136 addition of caution to 4.3.9 (7) port 9 function register (pf9) pp. 152, 155 to 159, 161 to 163, 165, 167, 169 to 184 modification of figure 4-8 , figure 4-11 to figure 4-15 , figure 4-17 to figure 4-19 , figure 4-21 , figure 4- 23 , figure 4-25 to figure 4-40 pp. 191 to 193 modification of note to table 4-19 using port pin as alternate-function pin p. 199 addition of caution to 4.6.3 cautions on on-chip debug pins p. 199 modification of description in 4.6.5 cautions on p10, p11, and p53 pins when power is turned on p. 199 modification of description in 4.6.6 hysteresis characteristics p. 199 addition of 4.6.7 cautions on separate bus mode p. 200 deletion of description to 5.1 features p. 204 addition of 5.5.1 (2) in v850es/sj2-h p. 213 modification of description in 5.6.1 (1) data wait control register 0 (dwc0) p. 216 modification of description in 5.6.4 (1) address wait control register (awc) p. 227 addition of description to 6.1 overview p. 229 addition of description to 6.2 (1) main clock oscillator p. 234 addition of note to 6.3 (3) cpu operation clock status register (ccls) p. 236 addition of description to 6.5.1 overview p. 236 addition of caution to 6.5.2 (1) pll control register (pllctl) p. 237 addition of description to 6.5.2 (2) clock control register (ckc) p. 239 modification of description in 6.5.3 (1) (b) to set idle2/stop mode in pll operation mode p. 244 modification of note in 7.4 (1) tmpn control register 0 (tpnctl0) p. 245 addition of description to 7.4 (2) tmpn control register 1 (tpnctl1) p. 247 addition of note and caution to 7.4 (3) tmpn i/o control register 0 (tpnioc0) p. 248 modification of description in 7.4 (4) tmpn i/o control register 1 (tpnioc1) p. 250 addition of description to 7.4 (6) tmpn option register 0 (tpnopt0) p. 252 addition of description to 7.4 (7) (a) function as compare register p. 252 addition of description to 7.4 (7) (b) function as capture register p. 252 addition of note and remark to table 7-2 function of capture/comp are register in each mode and how to write compare register p. 254 addition of description to 7.4 (8) (a) function as compare register p. 254 addition of description to 7.4 (8) (b) function as capture register p. 254 addition of note and remark to table 7-3 function of capture/comp are register in each mode and how to write compare register p. 258 addition of 7.6 (1) counter basic operation p. 259 addition of 7.6 (2) anytime write and batch write p. 264 modification of description in 7.6.1 interval timer mode (tpnmd2 to tpnmd0 bits = 000) pp. 265 to 267 modification of description in figure 7-8 register setting for interval timer mode operation p. 268 addition of description to figure 7-9 software processing flow in interval timer mode p. 269 modification of description and figure in 7.6.1 (2) (a) operation if tpnccr0 register is set to 0000h pp. 273, 274 addition of description to 7.6.1 (2) (d) operation of tpnccr1 register p. 275 addition of 7.6.1 (3) operation by external event count input (tipn0)
appendix e revision history user?s manual u16603ej5v1ud 1174 (3/10) page description pp. 276 to 279 modification of description in 7.6.2 external event count mode (tpnmd2 to tpnmd0 bits = 001) p. 277 modification of description in figure 7-14 basic timing in external event count mode p. 279 modification of description in figure 7-15 register setting for operation in external event count mode p. 281 modification of description in 7.6.2 (2) (a) operation if tpnccr0 register is set to ffffh p. 282 modification of description in 7.6.2 (2) (b) notes on rewriting the tpnccr0 register p. 284 addition of description to 7.6.2 (2) (c) operation of tpnccr1 register p. 285 addition of note and caution to figure 7-20 configuration in external trigger pulse output mode pp. 287, 288 modification of description in figure 7-22 setting of registers in external trigger pulse output mode p. 293 modification of description in 7.6.3 (2) (b) 0%/100% output of pwm waveform p. 297 addition of note and caution to figure 7-24 configuration in one-shot pulse output mode p. 298 modification of description in 7.6.4 one-shot pulse output mode (tpnmd2 to tpnmd0 bits = 011) pp. 299, 300 modification of description in figure 7-26 setting of registers in one-shot pulse output mode p. 304 modification of figure 7-28 configuration in pwm output mode p. 311 modification of description in 7.6.5 (2) (b) 0%/100% output of pwm waveform p. 313 addition of not e to figure 7-32 configuration in free-running timer mode p. 317 addition of note to figure 7-35 register setting in free-running timer mode p. 330 addition of 7.6.6 (3) note on capture operation p. 331 modification of figure and caution in figure 7-38 configuration in pulse width measurement mode pp. 333, 334 modification of description in figure 7-40 register setting in pulse width measurement mode p. 335 deletion of description in figure 7-41 software processing flow in pulse width measurement mode p. 336 addition of 7.6.7 (3) notes p. 343 modification of note to 8.4 (1) tmq0 control register 0 (tq0ctl0) p. 344 addition of description to 8.4 (2) tmq0 control register 1 (tq0ctl1) p. 345 addition of note and caution to 8.4 (3) tmq0 i/o control register 0 (tq0ioc0) p. 348 addition of description to 8.4 (6) tmq0 option register 0 (tq0opt0) p. 350 addition of description to 8.4 (7) (a) function as compare register p. 350 addition of description to 8.4 (7) (b) function as capture register p. 350 addition of note and remark in table 8-2 function of capture/comp are register in each mode and how to write compare register p. 352 addition of description to 8.4 (8) (a) function as compare register p. 352 addition of description to 8.4 (8) (b) function as capture register p. 352 addition of note and remark in table 8-3 function of capture/comp are register in each mode and how to write compare register p. 354 addition of description to 8.4 (9) (a) function as compare register p. 354 addition of description to 8.4 (9) (b) function as capture register p. 354 addition of note and remark in table 8-4 function of capture/comp are register in each mode and how to write compare register p. 356 addition of description to 8.4 (10) (a) function as compare register p. 356 addition of description to 8.4 (10) (b) function as capture register p. 356 addition of note and remark in table 8-5 function of capture/comp are register in each mode and how to write compare register p. 359 addition of 8.6 (1) counter basic operation
appendix e revision history user?s manual u16603ej5v1ud 1175 (4/10) page description p. 361 addition of 8.6 (2) anytime write and batch write p. 366 modification of description in 8.6.1 interval timer mode (tq0md2 to tq0md0 bits = 000) pp. 367 to 369 modification of description in figure 8-8 register setting for interval timer mode operation p. 370 addition of description to figure 8-9 software processing flow in interval timer mode p. 371 modification of description and figure in 8.6.1 (2) (a) operation if tq0ccr0 register is set to 0000h pp. 374, 375 addition of description to 8.6.1 (2) (d) operation of tq0ccr1 to tq0ccr3 registers p. 376 addition of 8.6.1 (3) operation by external event count input (tiq00) pp. 377, 379 addition of description to 8.6.2 external event count mode (tq0md2 to tq0md0 bits = 001) p. 378 modification of description in figure 8-14 basic timing in external event count mode p. 380 modification of description in figure 8-15 register setting for operation in external event count mode p. 382 modification of description in 8.6.2 (2) (a) operation if tq0ccr0 register is set to ffffh p. 383 modification of description in 8.6.2 (2) (b) notes on rewriting the tq0ccr0 register p. 386 addition of description to 8.6.2 (2) (c) operation of tq0ccr1 to tq0ccr3 registers p. 387 modification of description in 8.6.3 external trigger pulse output mode (tq0md2 to tq0md0 bits = 010) p. 387 addition of note and caution to figure 8-20 configuration in external trigger pulse output mode pp. 389 to 391 modification of description in figure 8-22 setting of registers in external trigger pulse output mode p. 396 modification of description in 8.6.3 (2) (b) 0%/100% output of pwm waveform p. 400 addition of note and caution to figure 8-24 configuration in one-shot pulse output mode p. 402 modification of description in 8.6.4 one-shot pulse output mode (tq0md2 to tq0md0 bits = 011) pp. 402 to 404 modification of description in figure 8-26 setting of registers in one-shot pulse output mode p. 409 modification of figure 8-28 configuration in pwm output mode p. 418 modification of description in 8.6.5 (2) (b) 0%/100% output of pwm waveform p. 421 addition of note to figure 8-32 configuration in free-running timer mode p. 425 addition of note to figure 8-35 register setting in free-running timer mode p. 440 addition of 8.6.6 (3) note on capture operation p. 441 modification of figure and addition of caution to figure 8-38 configuration in pulse width measurement mode pp. 443, 444 modification of description in figure 8-40 register setting in pulse width measurement mode p. 445 deletion of description in figure 8-41 software processing flow in pulse width measurement mode p. 446 addition of 8.6.7 (3) note p. 450 modification of figure 9-3 basic timing of operation in interval timer mode p. 453 modification of figure in 9.4.1 (2) (a) operation if tm0cmp0 register is set to 0000h p. 453 modification of figure in 9.4.1 (2) (b) operation if tm0cmp0 register is set to n p. 454 addition of 9.4.2 (3) do not set the tm0cmp0 register to ffffh p. 467 modification and addition of caution to 11.3 (1) watchdog timer mode register 2 (wdtm2) p. 468 modification of description in table 11-2 watchdog timer 2 clock selection p. 469 addition of caution to 11.3 (2) watchdog timer enable register (wdte) p. 482 modification and addition of caution to 13.4 (1) a/d converter mode register 0 (ada0m0) p. 483 addition of note and caution and modification of caution in 13.4 (2) a/d converter mode register 1 (ada0m1) p. 484 modification of description in table 13-2 conversion time selection in normal conversion mode (ada0hs1 bit = 0)
appendix e revision history user?s manual u16603ej5v1ud 1176 (5/10) page description p. 485 modification of description in table 13-3 conversion time selection in high-speed conversion mode (ada0hs1 bit = 1) p. 486 addition of caution to 13.4 (3) a/d converter mode register 2 (ada0m2) p. 487 addition of caution to 13.4 (4) analog input channel specification register (ada0s) p. 490 addition of caution to 13.4 (6) power-fail compare mode register (ada0pfm) p. 491 addition of caution to 13.4 (7) power-fail compare threshold value register (ada0pft) p. 492 addition of remark to 13.5.1 basic operation p. 493 modification of description in figure 13-3 conversion operation timing (continuous conversion) p. 494 addition of description to 13.5.3 (1) software trigger mode p. 494 addition of description to 13.5.3 (2) external trigger mode p. 495 addition of description to 13.5.3 (3) timer trigger mode p. 506 modification of description in 13.6 (4) alternate i/o p. 507 modification of description in figure 13-14 internal equivalent circuit of anin pin p. 508 modification of description in 13.6 (8) reading ada0crn register p. 509 modification of description in 13.6 (10) restriction for each mode p. 522 addition of description to 15.2 features p. 523 modification of block diagram in figure 15-4 block diagram of asynchronous serial interface an pp. 525, 526 modification of description in 15.4 (1) uartan control register 0 (uanctl0) pp. 527, 528 addition of description to 15.4 (4) uartan option control register 0 (uanopt0) p. 529 addition of caution to 15.4 (5) uartan status register (uanstr) p. 531 addition of description to 15.4 (6) uartan receive data register (uanrx) p. 531 addition of description to 15.4 (7) uartan transmit data register (uantx) p. 534 modification of description in figure 15-5 uarta transmit/receive data format p. 538 addition of caution to 15.6.4 sbf reception p. 542 modification of figure 15-12 continuous transmission operation timing p. 548 addition of caution to figure 15-16 configuration of baud rate generator p. 548 addition of description to 15.7 (1) (a) base clock p. 552 addition of description to table 15-3 baud rate generator setting data p. 559 addition of description to 16.2 features pp. 562, 564 addition of note and caution in 16.4 (1) csibn control register 0 (cbnctl0) p. 565 addition of 16.4 (1) (a) how to use cbnsce bit p. 566 addition of note to 16.4 (2) csibn control register 1 (cbnctl1) p. 569 addition of caution to 16.4 (4) csibn status register (cbnstr) p. 570 addition of 16.5 interrupt request signals p. 571 addition of 16.6.1 single transfer mode (master mode, transmission mode) p. 573 modification of description in 16.6.2 single transfer mode (master mode, reception mode) p. 575 modification of description in 16.6.3 single transfer mode (master mode, transmission/reception mode) p. 577 addition of 16.6.4 single transfer mode (slave mode, transmission mode) p. 579 addition of 16.6.5 single transfer mode (slave mode, reception mode) p. 581 addition of 16.6.6 single transfer mode (slave mode, transmission/reception mode) p. 583 addition of 16.6.7 continuous transfer mode (master mode, transmission mode)
appendix e revision history user?s manual u16603ej5v1ud 1177 (6/10) page description p. 585 modification of description in 16.6.8 continuous transfer mode (master mode, reception mode) p. 588 modification of description in 16.6.9 continuous transfer mode (master mode, transmission/reception mode) p. 592 addition of 16.6.10 continuous transfer mode (slave mode, transmission mode) p. 594 modification of description in 16.6.11 continuous transfer mode (slave mode, reception mode) p. 597 modification of description in 16.6.12 continuous transfer mode (slave mode, transmission/reception mode) p. 601 modification of description in 16.6.13 reception error pp. 602, 603 modification of description in 16.6.14 clock timing p. 606 addition of caution to 16.8.1 baud rate generation p. 618 deletion of description in 17.4 (1) iic control registers 0 to 2 (iicc0 to iicc2) p. 627 addition of description to 17.4 (6) i 2 c0n transfer clock setting method p. 628, 629 addition of description and note to table 17-2 clock settings p. 639 modification of description in 17.6.6 wait state p. 640 addition of note to 17.6.7 wait state cancellation method p. 642 addition of note to 17.7.1 (1) start ~ address ~ data ~ da ta ~ stop (normal transmission/reception) p. 643 addition of note and deletion of description to 17.7.1 (2) start ~ address ~ data ~ start ~ address ~ data ~ stop (restart) p. 644 addition of note to 17.7.1 (3) start ~ code ~ data ~ data ~ stop (extension code transmission) p. 648 modification of description in 17.7.2 (4) start ~ address ~ data ~ start ~ address ~ data ~ stop p. 649 addition of description to 17.7.3 slave device operation (when receiving extension code) p. 652 modification of description in 17.7.3 (4) start ~ code ~ data ~ start ~ address ~ data ~ stop p. 654 addition of description to 17.7.5 arbitration loss operation (operation as slave after arbitration loss) p. 656 addition of description to 17.7.6 operation when arbitration loss occurs (no communication after arbitration loss) p. 660 modification of description in 17.7.6 (6) when arbitration loss occurs due to low level of sda0n pin when attempting to generate a restart condition p. 662 modification of description in 17.7.6 (8) when arbitration loss occurs due to low level of sda0n pin when attempting to generate a stop condition p. 665 addition of description to 17.11 extension code p. 668 modification of description in 17.14.1 when communication reservation function is enabled (iicfn.iicrsvn bit = 0) p. 669 addition of note to table 17-6 wait periods p. 670 modification of figure 17-15 communication reservation timing p. 672 modification of description in table 17-7 wait periods p. 674 modification of description in 17.16 communication operations p. 681 modification of figure 17-21 slave operation flowchart (1) p. 682 modification of figure 17-22 slave operation flowchart (2) pp. 684 to 686 modification of figure 17-23 example of master to slave communication (when 9-clock wait is selected for both master and slave) pp. 687 to 689 modification of figure 17-24 example of slave to master communication (when 8-clock wait for master and 9-clock wait for slave are selected) p. 705 modification of description in figure 18-10 iebus controller block diagram p. 724 modification of caution in 18.3 (8) iebus slave address register (sar)
appendix e revision history user?s manual u16603ej5v1ud 1178 (7/10) page description p. 735 addition of description to 18.3 (17) iebus clock select register (ocks2) p. 757 addition of caution to chapter 19 can controller p. 758 deletion of description in table 19-1 overview of functions p. 774 modification of description in 19.3.6 (4) (b) error counter p. 775 addition of caution to 19.3.6 (5) (a) recovery from bus-off state through normal recovery sequence p. 778 modification of description in figure 19-18 segment setting p. 823 addition of caution to 19.6 (1) cann global control register (cngmctrl) p. 826 addition of caution to 19.6 (3) cann global automatic block transmission control register (cngmabt) pp. 830 to 832 modification of description in 19.6 (6) cann module control register (cnctrl) p. 839 addition of caution to 19.6 (11) cann module interrupt status register (cnints) p. 844 addition of note to 19.6 (15) cann module receive history list register (cnrgpt) p. 846 addition of note to 19.6 (17) cann module transmit history list register (cntgpt) p. 853 addition of caution to 19.6 (22) cann message id register m (cnmidlm, cnmidhm) pp. 855, 856 addition of caution to 19.6 (23) cann message control register m (cnmctrlm) p. 863 addition of 19.9.2 reading reception data p. 864 addition of caution to 19.9.3 receive history list function p. 871 addition of remark to 19.10.1 message transmission p. 872 addition of caution to 19.10.2 transmit history list function p. 878 addition of description to 19.11.1 (2) status in can sleep mode p. 878 addition of description to 19.11.1 (3) releasing can sleep mode p. 879 addition of caution to 19.11.2 (1) entering can stop mode p. 879 addition of description to 19.11.2 (2) status in can stop mode p. 880 addition of description to 19.11.3 example of using power saving modes p. 884 addition of description to 19.13.3 self-test mode p. 885 addition of 19.13.4 transmission/reception operation in each operation mode p. 888 addition of description to 19.15.1 bit rate setting conditions p. 899 addition of note to figure 19-39 message buffer redefinition p. 903 addition of remark to figure 19-43 transmission via interrupt (using cnlopt register) p. 904 addition of remark to figure 19-44 transmission via interrupt (using cntgpt register) p. 905 addition of remark to figure 19-45 transmission via software polling p. 906 addition of note and caution to figure 19-46 transmission abort processing (other than in normal operation mode with abt) p. 907 addition of note and caution to figure 19-47 transmission abort processing except for abt transmission (normal operation mode with abt) p. 910 addition of remark to figure 19-49 reception via interrupt (using cnlipt register) p. 911 modification of figure and addition of remark to figure 19-50 reception via interrupt (using cnrgpt register) p. 912 modification of figure and addition of remark to figure 19-51 reception via software polling p. 913 modification of figure and deletion of caution in figure 19-52 setting can sleep mode/stop mode p. 914 modification of figure 19-53 clear can sleep/stop mode p. 915 addition of figure and addition of caution to figure 19-54 bus-off recovery (other than in normal operation mode with abt)
appendix e revision history user?s manual u16603ej5v1ud 1179 (8/10) page description p. 916 addition of figure 19-55 bus-off recovery (normal operation mode with abt) p. 917 deletion of a part of figure 19-56 normal shutdown process p. 920 modification of figure 19-59 setting cpu standby (from can sleep mode) p. 921 modification of figure 19-60 setting cpu standby (from can stop mode) pp. 929, 930 modification of note and addition of caution to 20.3 (6) dma trigger factor registers 0 to 3 (dtfr0 to dtfr3) p. 945 modification of description in 20.13 (8) bus arbitration for cpu p. 945 modification of description in 20.13 (11) dma start factor p. 951 modification of description in chapter 22 interrupt/exception processing function p. 951 addition of description to 22.1 features p. 952 addition of note to table 22-1 interrupt source list p. 961 modification of description in 22.3 maskable interrupts p. 968 addition of caution to 22.3.4 interrupt control register (xxicn) p. 970 addition of note to table 22-2 interrupt control register (xxicn) p. 973 addition of note and deletion of description in 22.3.5 interrupt mask registers 0 to 4 (imr0 to imr4) p. 980 addition of caution to 22.5.1 (2) restore p. 988 modification of description in 22.6.2 (5) noise elimination control register (nfc) p. 989 addition of description to 22.7 interrupt acknowledge time of cpu p. 990 modification of description in figure 22-15 pipeline operation at interrupt request signal acknowledgment of v850es/sj2 (outline) p. 991 addition of figure 22-16 pipeline operation at interrupt request signal acknowledgment of v850es/sj2-h (outline) p. 992 addition of 22.9 (2) interrupt control register (xxicn) of v850es/sj2-h p. 992 addition of 22.9 (3) interrupt control register (xxicn) of v850es/sj2 and v850es/sj2-h p. 992 addition of 22.9 (4) in-service priority register (ispr) p. 997 addition of caution to 24.2 (1) power save control register (psc) p. 1000 addition of note to 24.3.2 releasing halt mode p. 1003 addition of note to 24.4.2 releasing idle1 mode p. 1005 addition of note to 24.5.2 releasing idle2 mode p. 1006 addition of description to table 24-7 operating status in idle2 mode p. 1008 addition of note to 24.6.2 releasing stop mode p. 1010 addition of description to table 24-9 operating status in stop mode p. 1012 modification of caution to 24.7.1 setting and operation status p. 1012 addition of note to 24.7.2 releasing subclock operation mode p. 1013 modification of description in table 24-10 operating status in subclock operation mode p. 1015 addition of note to 24.8.2 releasing sub-idle mode p. 1016 addition of description to table 24-12 operating status in sub-idle mode p. 1017 addition of note to 25.1 (1) reset sources p. 1018 modification of description in 25.1 (2) emergency operation mode p. 1018 addition of figure 25-1 (b) v850es/sj2-h p. 1019 addition of description to 25.2 registers to check reset source p. 1019 addition of note to 25.2 (1) reset source flag register (resf)
appendix e revision history user?s manual u16603ej5v1ud 1180 (9/10) page description p. 1020 modification of description in table 25-1 hardware status on reset pin input p. 1022 modification of description in table 25-2 hardware status during watchdog timer 2 reset operation p. 1024 modification of title of 25.3.3 reset operation by low-voltage detector (lvires) (v850es/sj2 only) p. 1024 modification of description in table 25-3 hardware status during reset operation by low-voltage detector p. 1025 addition of 25.3.4 reset operation by clock monitor (clmres) p. 1028 addition of description to and addition of caution to 25.3.5 (2) firmware operation (flash memory version only) p. 1036 addition of description in chapter 27 low-voltage detector p. 1036 deletion of description to 27.1 functions p. 1037 addition of caution to 27.3 (1) low voltage detection register (lvim) p. 1038 addition of caution to 27.3 (2) low voltage detection level selection register (lvis) p. 1043 deletion of description in figure 28-1 regulator p. 1051 addition of description to 30.2 memory configuration p. 1053 addition of figure 30-1 (b) v850es/sj2-h (640 kb) p. 1055 modification of description in table 30-3 security functions p. 1056 addition of table 30-4 security setting p. 1058 addition of description to 30.4.2 communication mode p. 1060 addition of description to table 30-5 signal connections of dedicated flash memory programmer (pg- fp4, pg-fp5) pp. 1061, 1062 modification of description in table 30-6 wiring of v850es/sj2, v850es/sj2-h flash writing adapters (fa-144gj-uen-a) pp. 1063, 1064 modification of title of figure 30-6 wiring example of v850es/sj2 flash writing adapter (fa-144gj- uen-a) (in csib0 + hs mode) p. 1065 modification of description in figure 30-7 procedure for manipulating flash memory p. 1073 modification of description in 30.5.2 (2) interrupt support p. 1075 addition of caution to 30.5.5 (1) flmd0 pin p. 1077 addition of description to chapter 31 on-chip debug function p. 1078 addition of description to 31.2 connection circuit example p. 1078 modification of description in 31.3 (2) dck p. 1080 addition of note in 31.4 (1) on-chip debug mode register (ocdm) p. 1083 addition of note in 31.6.1 security id p. 1086 modification of description in 31.7 (4), (6), (7) p. 1089 modification of description in 32.2 capacitance p. 1089 addition of 32.3 (2) v850es/sj2-h p. 1090 addition of description to 32.4.1 main clock oscillator characteristics p. 1091 modification of description in 32.4.1 (i) kyocera kinseki corporation: crystal resonator p. 1092 addition of 32.4.1 (ii) murata mfg. co. ltd.: ceramic resonator p. 1093 addition of note to 32.4.2 subclock oscillator characteristics p. 1094 addition of 32.4.3 (2) v850es/sj2-h p. 1095 addition of 32.5 (2) v850es/sj2-h p. 1099 addition of 32.6.2 (2) v850es/sj2-h
appendix e revision history user?s manual u16603ej5v1ud 1181 (10/10) page description p. 1100 deletion of description and addition of note in 32.7 (1) in stop mode p. 1102 addition of description to 32.8.1 clkout output timing p. 1102 addition of caution to 32.8.2 (1) in multiplexed bus mode p. 1103 modification and addi tion of description in 32.8.2 (1) (a) read/write cycle (clkout asynchronous) p. 1108 addition of caution to 32.8.2 (2) in separate bus mode p. 1108 addition and modification of description in 32.8.2 (2) (a) read cycle (clkout asynchronous): in separate bus mode p. 1110 addition of description to 32.8.2 (2) (b) write cycle (clkout asynchronous): in separate bus mode p. 1112 addition of description to 32.8.2 (2) (c) read cycle (clkout synchronous): in separate bus mode p. 1113 addition of description to 32.8.2 (2) (d) write cycle (clkout synchronous): in separate bus mode p. 1114 addition of description to 32.8.2 (3) (a) clkout asynchronous p. 1117 addition of note to 32.9 (2) interrupt, flmd0 pin timing p. 1118 addition of description to 32.9 (6) (b) slave mode p. 1123 modification of title of 32.9 (12) lvi circuit specification (v850es/sj2 only) p. 1124 addition of description to 32.9 (13) ram retention detection p. 1125 addition of description to 32.10 (1) basic characteristics p. 1125 addition of description to 32.10 (2) serial write operation characteristics p. 1127 addition of 32.10 (3) (b) v850es/sj2-h p. 1129 modification of description in chapter 34 recommended soldering conditions p. 1133 addition of figure a-1 (3) when using on-chip debug emulator ie-v850e1-cd-nw p. 1134 addition of figure a-1 (4) when using minicube qb-v850mini p. 1135 modification of description in a.2 language processing software p. 1138 modification of description in figure a-3 system config uration (qb-v850essx2 used) p. 1139 modification of note in a.4.2 when using iecube qb-v850essx2 p. 1140 addition of a.4.3 when using on-chip debug emulator ie-v850e1-cd-nw p. 1141 addition of a.4.4 when using minicube qb-v850mini p. 1142 modification of description in a.5 debugging tools (software) p. 1143 modification of description in a.7 flash memory writing tools p. 1144 addition of appendix b major differences between v850es/sj2 and v850es/sj2-h pp. 1165, 1166, 1168, 1170, 1171 addition of note t o d.2 instruction set (in alphabetical order)
appendix e revision history user?s manual u16603ej5v1ud 1182 e.2 revision history of previous editions a history of the revisions up to this edition is shown below . ?applied to:? indicates the chapters to which the revision was applied. (1/11) edition description applied to: addition of note 2 in 1.5 pin configuration (top view) chapter 1 introduction modification of 2.1 (1) port pins modification of 2.1 (2) non-port pins modification of table 2-2 pin operation states in various modes modification of figure 2-1 pin i/o circuits chapter 2 pin functions addition of 3.3.1 specifying operation mode addition of caution in 3.4.5 recommended use of address space addition of notes in 3.4.6 peripheral i/o registers addition of 3.4.9 (2) accessing specific on-chip peripheral i/o registers chapter 3 cpu function modification of 4.3 port configuration addition of 4.4 block diagrams addition of 4.6 cautions chapter 4 port functions modification of 5.2.1 pin status when internal rom, internal ram, or on-chip peripheral i/o is accessed addition of cautions in 5.6.4 programmable address wait function modification of 5.10 bus timing chapter 5 bus control function modification of figure 6-1 clock generator modification of 6.3 (1) (a) example of setting main clock operation subclock operation modification of 6.3 (1) (b) example of setting subclock operation main clock operation addition of caution 2 in 6.5.2 (2) clock control register (ckc) modification of 6.5.3 (1) to use pll chapter 6 clock generation function modification of chapter 7 16-bit timer/event counter p (tmp) chapter 7 16-bit timer/event counter p (tmp) modification of chapter 8 16-bit timer/event counter q (tmq) chapter 8 16-bit timer/event counter q (tmq) modification of 9.4.1 interval timer mode addition of 9.4.2 cautions chapter 9 16-bit interval timer m (tmm) modification of 10.2 configuration modification of 10.4.1 operation as watch timer chapter 10 watch timer functions 2nd addition of caution in 11.3 (1) watchdog timer mode register 2 (wdtm2) chapter 11 functions of watchdog timer 2
appendix e revision history user?s manual u16603ej5v1ud 1183 (2/11) edition description applied to: addition of caution 2 in 12.2 (1) real-time output buffer registers nl, nh (rtbln, rtbhn) addition of caution 3 in 12.3 (1) real-time output port mode register n (rtpmn) chapter 12 real-time output function (rto) addition of 13.2 functions modification of 13.3 configuration addition of caution 4 in 13.4 (1) a/d converter mode register 0 (ada0m0) addition of caution 2 in 13.4 (5) a/d conversion result registers n, nh (ada0crn, ada0crnh) addition of 13.5.1 <9> addition of 13.6 (8) standby mode chapter 13 a/d converter modification of figure 14-1 block diagram of d/a converter modification of 14.4.2 operation in real-time output mode addition of 14.4.3 (7) chapter 14 d/a converter modification of 15.4 (1) uartan control register 0 (uanctl0) addition of remark in 15.6.2 sbf transmission/reception format addition of figure 15-15 timing of rxdan signal judged as noise addition of caution in 15.7 (2) uartan control register 1 (uanctl1) addition of caution in 15.7 (3) uartan control register 2 (uanctl2) addition of 15.8 cautions chapter 15 asynchronous serial interface a (uarta) addition of remark in 16.3 configuration modification of 16.4 (1) csibn control register 0 (cbnctl0) modification of caution in 16.4 (2) csibn control register 1 (cbnctl1) modification of 16.5 operation modification of 16.6 (1) sckbn pin modification of 16.7 operation flow chapter 16 3-wire variable-length serial i/o (csib) addition of note in 17.4 (1) iic control registers 0 to 2 (iicc0 to iicc2) addition of caution in 17.4 (2) iic status registers 0 to 2 (iics0 to iics2) addition of 17.16.3 slave operation chapter 17 i 2 c bus modification of chapter 19 can controller chapter 19 can controller modification of 20.3 control registers modification of 20.4 transfer targets modification of 20.5 transfer modes modification of 20.6 transfer types modification of 20.7 dma channel priorities addition of 20.8 time related to dma transfer modification of 20.9 dma transfer start factors modification of 20.10 dma abort factors 2nd modification of 20.11 end of dma transfer chapter 20 dma function (dma controller)
appendix e revision history user?s manual u16603ej5v1ud 1184 (3/11) edition description applied to: addition of 20.12 operation timing modification of 20.13 cautions chapter 20 dma function (dma controller) modification of caution in 21.3 (2) crc data register (crcd) chapter 21 crc function addition of note 1 in table 22-1 interrupt source list modification of caution in 22.2 (2) if intwdt2 request signal is issued while nmi is being serviced addition of note and caution in 22.3.5 interrupt mask registers 0 to 4 (imr0 to imr4) addition of caution in 22.6.2 debug trap modification of figure 22-14 pipeline operation at interrupt request signal acknowledgment (outline) addition of 22.9 cautions chapter 22 interrupt/exception processing function addition of caution 2 in 23.1 function chapter 23 key interrupt function addition of note in table 24-5 operating status in idle1 mode addition of note in table 24-7 operating status in idle2 mode addition of notes 1 to 4 in table 24-9 operating status in stop mode addition of caution 2 in 24.7.1 setting and operation status addition of caution in table 24-10 operating status in subclock operation mode addition of caution 2 in 24.8.2 (1) chapter 24 standby function modification of 25.2 (1) reset source flag register (resf) chapter 25 reset functions addition of caution in figure 26-1 regulator chapter 26 regulator addition of note in 27.2 (1) correction address registers 0 to 3 (corad0 to corad3) chapter 27 rom correction function modification of chapter 28 flash memory chapter 28 flash memory addition of chapter 29 on-chip debug function chapter 29 on-chip debug function addition of chapter 30 electrical specifications (target values) chapter 30 electrical specifications (target values) addition of chapter 31 package drawing chapter 31 package drawing addition of appendix a register index appendix a register index addition of appendix b instruction set list appendix b instruction set list 2nd addition of appendix c revision history appendix c revision history
appendix e revision history user?s manual u16603ej5v1ud 1185 (4/11) edition description applied to: deletion of indication of the pr eliminary version, addition of note to the products under development throughout addition of note 1 in 2.1 (1) port pins modification of 2.1 (2) non-port pins modification of table 2-2 pin operation states in various modes chapter 2 pin functions modification of table 3-2 system register numbers modification of 3.2.2 (4) program status word (psw) addition of description in 3.2.2 (6) exception/debug trap status saving registers (dbpc and dbpsw) addition of caution in figure 3-1 image on address space addition of note 2 in figure 3-2 data memory map (physical addresses) addition of 3.4.4 (4) programmable peripheral i/o area modification of figure 3-12 recommended memory map modification of 3.4.6 peripheral i/o registers modification of 3.4.9 (1) registers to be set first modification of 3.4.9 (2) accessing specific on-chip peripheral i/o registers modification of 3.4.9 (3) cautions on using flash memory version addition of 3.4.9 (4) restriction on conflict between sld instruction and interrupt request chapter 3 cpu function modification of table 4-4 port 0 alternate-function pins modification of table 4-8 port 5 alternate-function pins addition of remark in 4.3.7 (1) (a) , (b) modification of figure 4-12 block diagram of type e-3 modification of figure 4-23 block diagram of type n-3 modification of 4.6.1 (1) modification of 4.6.4 cautions on p05/intp2/drst pin chapter 4 port functions modification of 5.1 features addition of note 2 in figure 5-1 data memory map: physical address addition of description in 5.6.2 external wait function chapter 5 bus control function modification of figure 6-1 clock generator addition of cautions in 6.3 (2) internal oscillation mode register (rcm) addition of note in 6.3 (3) cpu operation clock status register (ccls) addition to table 6-1 operation status of each clock addition of caution 3 in 6.5.2 (2) clock control register (ckc) addition of description in 6.5.2 (3) lock register (lockr) 3rd modification of 6.5.3 (1) when pll is used chapter 6 clock generation function
appendix e revision history user?s manual u16603ej5v1ud 1186 (5/11) edition description applied to: addition of caution 3 in 7.4 (5) tmpn i/o control register 2 (tpnioc2) modification of 7.5.1 (2) (a) operation if tpnccr0 register is set to 0000h modification of figure 7-10 basic timing in external event count mode modification of 7.5.2 (2) operation timing in external event count mode modification of 7.5.3 (2) (b) 0%/100% output of pwm waveform modification of 7.5.5 (2) (b) 0%/100% output of pwm waveform modification of 7.5.7 pulse width measurement mode (tpnmd2 to tpnmd0 bits = 110) modification of 7.6 (1) selector operation control register 0 (selcnt0) addition of 7.7 cautions chapter 7 16-bit timer/event counter p (tmp) addition of caution 3 in 8.4 (5) tmq0 i/o control register 2 (tq0ioc2) modification of 8.5.1 (2) (a) operation if tq0ccr0 register is set to 0000h modification of figure 8-10 basic timing in external event count mode modification of 8.5.2 (2) operation timing in external event count mode addition of remark 2 in figure 8-18 setting of registers in external trigger pulse output mode modification of 8.5.3 (2) (b) 0%/100% output of pwm waveform addition of remark 2 in figure 8-26 register setting in pwm output mode modification of 8.5.5 (2) (b) 0%/100% output of pwm waveform modification of figure 8-31 register setting in free-running timer mode modification of 8.5.7 pulse width measurement mode (tq0md2 to tq0md0 bits = 110) addition of 8.7 cautions chapter 8 16-bit timer/event counter q (tmq) modification of 9.3 (1) tmm0 control register (tm0ctl0) addition of caution in 9.4 operation modification of 9.4.1 (2) interval timer mode operation timing chapter 9 16-bit interval timer m (tmm) modification of 10.3 (1) prescaler mode register 0 (prsm0) addition of description in 10.3 (2) prescaler compare register 0 (prscm0) addition of description in 10.3 (3) watch timer operation mode register (wtm) chapter 10 watch timer functions addition of description in 11.3 (1) watchdog timer mode register 2 (wdtm2) addition of description in 11.4 operation chapter 11 functions of watchdog timer 2 modification of table 13-2 and table 13-3 modification of 13.5.1 basic operation addition of 13.5.2 conversion operation timing addition of description in 13.6 (4) alternate i/o addition of 13.6 (6) internal equivalent circuit 3rd addition of description in 13.6 (9) standby mode chapter 13 a/d converter
appendix e revision history user?s manual u16603ej5v1ud 1187 (6/11) edition description applied to: modification of 15.4 (1) uartan control register 0 (uanctl0) modification of 15.4 (4) uartan option control register 0 (uanopt0) addition of description in 15.6.8 reception errors modification of 15.7 (1) (a) base clock modification of table 15-3 baud rate generator setting data addition of description in 15.8 cautions chapter 15 asynchronous serial interface a (uarta) modification of 16.2 features modification of 16.4 (1) csibn control register 0 (cbnctl0) modification of 16.4 (2) csibn control register 1 (cbnctl1) addition of description in 16.4 (4) csibn status register (cbnstr) modification of 16.5.7 continuous mode (slave mode, reception mode) modification of 16.5.8 clock timing modification of 16.6 (1) sckbn pin addition of 16.9 cautions chapter 16 3-wire variable-length serial i/o (csib) modification of figure 17-4 block diagram of i 2 c0n addition of description in 7.4 (1) iic control registers 0 to 2 (iicc0 to iicc2) addition of remark in 17.4 (4) iic clock select registers 0 to 2 (iiccl0 to iiccl2) modification of table 17-2 clock settings addition of caution in 17.6.1 start condition addition of description in 17.15 cautions chapter 17 i 2 c bus revision of chapter 19 can controller chapter 19 can controller modification of figure 20-2 priority of dma (2) chapter 20 dma function (dma controller) modification of 22.3.4 interrupt control register (xxicn) modification of 22.3.8 watchdog timer mode register 2 (wdtm2) modification of 22.8 periods in which interrupts are not acknowledged by cpu addition of description in 22.9 cautions chapter 22 interrupt/exception processing function modification of 23.2 (1) key return mode register (krm) addition of 23.3 cautions chapter 23 key interrupt function modification of table 24-1 standby modes modification of figure 24-1 status transition modification of 24.2 (2) power save mode register (psmr) modification of 24.6.1 setting and operation status modification of 24.8.1 setting and operation status chapter 24 standby function revision of chapter 25 reset functions chapter 25 reset functions addition of chapter 26 clock monitor chapter 26 clock monitor 3rd addition of chapter 27 low-voltage detector (lvi) chapter 27 low- voltage detector (lvi)
appendix e revision history user?s manual u16603ej5v1ud 1188 (7/11) edition description applied to: modification of 29.2 (1) correction address registers 0 to 3 (corad0 to corad3) addition of 29.4 cautions chapter 29 rom correction function modification of chapter 30 flash memory modification of figure 30-1 flash memory mapping modification of table 30-4 signal connections of dedicated flash programmer (pg-fp4) modification of table 30-5 wiring of flash writing adapter for v850es/sj2 (fa- 144gj-uen) modification of figure 30-6 example of wiring of v850es/sj2 flash writing adapter (fa-144gj-uen) (in csib0 + hs mode) modification of table 30-10 internal resources used chapter 30 flash memory addition of caution in chapter 31 on-chip debug function addition of note in 31.6.1 security id addition of description in 31.7 cautions chapter 31 on-chip debug function revision of chapter 32 electrical specifications chapter 32 electrical specifications addition of chapter 34 recommended soldering conditions chapter 34 recommended soldering conditions addition of appendix a development tools appendix a development tools 3rd addition of d.2 revision history of previous editions appendix d revision history deletion of indication ?under development ? for the following products (developed) pd703264, 703264y, 703265, 703265y, 703266, 703266y, 703274, 703274y, 703275, 703275y, 703276, 703276y throughout modification of chapter 1 introduction modification of table 1-1 v850es/sj2 product list chapter 1 introduction modification of 2.1 (2) non-port pins modification of 2.2 pin states addition of 2.4 cautions chapter 2 pin functions modification of 3.4.9 (2) accessing specific on-chip peripheral i/o registers and (3) system reserved area chapter 3 cpu function addition of caution to table 4-5 port 1 alternate-function pins modification of caution 1 and addition of caution 2 in 4.3.2 (2) port 1 mode register (pm1) modification of table 4-6 port 3 alternate-function pins modification of table 4-7 port 4 alternate-function pins addition of caution 1 to table 4-8 port 5 alternate-function pins modification of table 4-11 port 8 alternate-function pins 4th modification of figure 4-9 block diagram of type d-3 chapter 4 port functions
appendix e revision history user?s manual u16603ej5v1ud 1189 (8/11) edition description applied to: modification of figure 4-11 block diagram of type e-2 modification of figure 4-12 block diagram of type e-3 modification of figure 4-17 block diagram of type g-5 modification of figure 4-18 block diagram of type g-6 addition of figure 4-19 block diagram of type g-12 modification of figure 4-23 block diagram of type n-2 modification of figure 4-24 block diagram of type n-3 modification of figure 4-34 block diagram of type u-10 modification of figure 4-35 block diagram of type u-11 modification of caution in table 4-19 using port pin as alternate-function pin addition of 4.6.5 cautions on p10, p11, and p53 pins when power is turned on chapter 4 port functions addition and modification of description in 6.3 (1) processor clock control register (pcc) addition of description in 6.3 (1) (a) example of setting main clock operation subclock operation addition of caution in 6.3 (1) (b) example of setting subclock operation main clock operation addition of caution 2 to 6.5.2 (4) pll lockup time specification register (plls) chapter 6 clock generation function modification of 7.4 (7) tmpn capture/compare register 0 (tpnccr0) modification of 7.4 (8) tmpn capture/compare register 1 (tpnccr1) modification of 7.4 (9) tmpn counter read buffer register (tpncnt) modification of figure 7-4 register setting for interval timer mode operation modification of figure 7-10 basic timing in external event count mode modification of figure 7-11 register setting for operation in external event count mode addition of caution 2 to 7.5.2 (2) operation timing in external event count mode modification of 7.5.2 (2) (c) operation of tpnccr1 register modification of figure 7-17 basic timing in external trigger pulse output mode addition of description to 7.5.3 external trigger pulse output mode (tpnmd2 to tpnmd0 bits = 010) addition of note 2 to figure 7-18 setting of registers in external trigger pulse output mode addition of note 2 to figure 7-22 setting of registers in one-shot pulse output mode modification of figure 7-23 software processing flow in one-shot pulse output mode modification of figure 7-26 setting of registers in pwm output mode modification of 7.7 (1) capture operation chapter 7 16-bit timer/event counter p (tmp) modification of 8.4 (7) tmq0 capture/compare register 0 (tq0ccr0) modification of 8.4 (8) tmq0 capture/compare register 1 (tq0ccr1) 4th modification of 8.4 (9) tmq0 capture/compare register 2 (tq0ccr2) chapter 8 16-bit timer/event counter q (tmq)
appendix e revision history user?s manual u16603ej5v1ud 1190 (9/11) edition description applied to: modification of 8.4 (10) tmq0 capture/compare register 3 (tq0ccr3) modification of 8.4 (11) tmq0 counter read buffer register (tq0cnt) modification of figure 8-4 register setting for interval timer mode operation modification of figure 8-10 basic timing in external event count mode modification of figure 8-11 register setting for operation in external event count mode addition of caution 2 to 8.5.2 (2) operation timing in external event count mode modification of 8.5.2 (2) (c) operation of tq0ccr1 to tq0ccr3 registers modification of figure 8-17 basic timing in external trigger pulse output mode addition of description to 8.5.3 external trigger pulse output mode (tq0md2 to tq0md0 bits = 010) addition of note to figure 8-18 setting of registers in external trigger pulse output mode addition of note to figure 8-22 setting of registers in one-shot pulse output mode modification of figure 8-23 software processing flow in one-shot pulse output mode addition of note and modification of figure 8-26 setting of registers in pwm output mode modification of 8.7 (1) capture operation chapter 8 16-bit timer/event counter q (tmq) modification of figure 10-1 block diagram of watch timer chapter 10 watch timer functions modification of figure 11-1 block diagram of watchdog timer 2 modification of 11.3 (1) watchdog timer mode register 2 (wdtm2) chapter 11 functions of watchdog timer 2 modification of 12.2 (1) real-time output buffer registers nl, nh (rtbln, rtbhn) chapter 12 real-time output function (rto) modification of descri ption and addition of caution 3 in 13.4 (1) a/d converter mode register 0 (ada0m0) addition of caution 1 in 13.4 (2) a/d converter mode register 1 (ada0m1) modification of table 13-2 conversion time selection in normal conversion mode (ada0hs1 bit = 0) and table 13-3 conversion time selection in high- speed conversion mode (ada0hs1 bit = 1) modification of 13.4 (5) a/d conversion result registers n, nh (ada0crn, ada0crnh) modification of figure 13-3 conversion operation timing (continuous conversion) modification of (9) and addition of (10) to (13) in 13.6 cautions addition of description to 13.7 (6) differential linearity error chapter 13 a/d converter modification of 14.1 functions 4th modification of 14.4.3 cautions chapter 14 d/a converter
appendix e revision history user?s manual u16603ej5v1ud 1191 (10/11) edition description applied to: addition of caution to 15.4 (4) uartan option control register 0 (uanopt0) modification of 15.7 (4) baud rate chapter 15 asynchronous serial interface a (uarta) addition of descripti on and modification of 16.4 (1) csibn control register 0 (cbnctl0) modification of 16.5.1 single transfer mode (master mode, transmission/reception mode) modification of 16.5.2 single transfer mode (master mode, reception mode) modification of 16.5.3 continuous mode (master mode, transmission/reception mode) modification of 16.5.4 continuous mode (master mode, reception mode) modification of 16.5.5 continuous reception mode (error) modification of 16.5.6 continuous mode (slave mode, transmission/reception mode) modification of 16.5.7 continuous mode (slave mode, reception mode) addition of caution to 16.5.8 clock timing modification of 16.6 (1) sckbn pin addition of 16.9 cautions (3) chapter 16 3-wire variable-length serial i/o (csib) modification of figure 17-4 block diagram of i 2 c0n . addition of 17.3 configuration (13) . addition and modification of description to 17.4 (1) iic control registers 0 to 2 (iicc0 to iicc2) addition and modification of description to 17.4 (2) iic status registers 0 to 2 (iics0 to iics2) addition of description to 17.4 (3) iic flag registers 0 to 2 (iicf0 to iicf2) addition of description to 17.4 (4) iic clock select registers 0 to 2 (iiccl0 to iiccl2) addition of description to 17.4 (5) iic function expansion registers 0 to 2 (iicx0 to iicx2) addition of description to 17.4 (8) iic shift registers 0 to 2 (iic0 to iic2) addition of description to 17.4 (9) slave address registers 0 to 2 (sva0 to sva2) addition of 17.6.7 wait cancellation method modification of 17.7.1 (1) start ~ address ~ data ~ data ~ stop (normal transmission/reception) modification of 17.7.1 (2) start ~ address ~ data ~ start ~ address ~ data ~ stop (restart) addition of <1> to 17.7.6 (6) when arbitration loss occurs due to low level of sda0n pin when attempting to generate a restart condition addition of <1> to 17.7.6 (7) when arbitration loss occurs due to a stop condition when attempting to generate a restart condition addition of <1> to 17.7.6 (8) when arbitration loss occurs due to low level of sda0n pin when attempting to generate a stop condition 4th modification of figure 17-21 slave operation flowchart (1) chapter 17 i 2 c bus
appendix e revision history user?s manual u16603ej5v1ud 1192 (11/11) edition description applied to: modification of figure 18-32 slave transmission (interval of interrupt request signal occurrence) and figure 18-33 slave reception (interval of interrupt request signal occurrence) chapter 18 can controller addition of caution to 19.6 registers chapter 19 can controller addition of caution 4 to 20.3 (1) dma source address registers 0 to 3 (dsa0 to dsa3) addition of caution 4 to 20.3 (2) dma destination address registers 0 to 3 (dda0 to dda3) addition of caution 2 to 20.3 (3) dma byte count registers 0 to 3 (dbc0 to dbc3) chapter 20 dma function (dma controller) modification of 21.3 (2) crc data register (crcd) chapter 21 crc function addition of note in figure 22-4 software reset processing chapter 22 interrupt/exception processing function modification of 23.3 cautions chapter 23 key interrupt function modification of figure 24-1 status transition addition of caution 2 to 24.4.1 setting and operation status addition of caution 2 to 24.5.1 setting and operation status addition of caution 2 to 24.6.1 setting and operation status modification of table 24-9 operating status in stop mode modification of 24.6.3 securing oscillation stabilization time when releasing stop mode addition of caution 2 to 24.8.1 setting and operation status chapter 24 standby function addition of note 2 to table 25-1 hardware status on reset pin input modification of 25.3.5 reset function operation flow chapter 25 reset functions modification of 27.3 (1) low voltage detection register (lvim) addition of note to 27.3 (3) internal ram data status register (rams) chapter 27 low- voltage detector (lvi) modification of 31.6.1 security id modification of 31.6.2 setting chapter 31 on-chip debug function modification of chapter 32 electrical specifications chapter 32 electrical specifications modification of chapter 34 recommended soldering conditions chapter 34 recommended soldering conditions 4th modification of a.4.2 when using iecube qb-v850essx2 appendix a development tools
nec electronics corporation 1753, shimonumabe, nakahara-ku, kawasaki, kanagawa 211-8668, japan tel: 044-435-5111 http://www.necel.com/ [america] nec electronics america, inc. 2880 scott blvd. santa clara, ca 95050-2554, u.s.a. tel: 408-588-6000 800-366-9782 http://www.am.necel.com/ [asia & oceania] nec electronics (china) co., ltd 7th floor, quantum plaza, no. 27 zhichunlu haidian district, beijing 100083, p.r.china tel: 010-8235-1155 http://www.cn.necel.com/ shanghai branch room 2509-2510, bank of china tower, 200 yincheng road central, pudong new area, shanghai, p.r.china p.c:200120 tel:021-5888-5400 http://www.cn.necel.com/ shenzhen branch unit 01, 39/f, excellence times square building, no. 4068 yi tian road, futian district, shenzhen, p.r.china p.c:518048 tel:0755-8282-9800 http://www.cn.necel.com/ nec electronics hong kong ltd. unit 1601-1613, 16/f., tower 2, grand century place, 193 prince edward road west, mongkok, kowloon, hong kong tel: 2886-9318 http://www.hk.necel.com/ nec electronics taiwan ltd. 7f, no. 363 fu shing north road taipei, taiwan, r. o. c. tel: 02-8175-9600 http://www.tw.necel.com/ nec electronics singapore pte. ltd. 238a thomson road, #12-08 novena square, singapore 307684 tel: 6253-8311 http://www.sg.necel.com/ nec electronics korea ltd. 11f., samik lavied?or bldg., 720-2, yeoksam-dong, kangnam-ku, seoul, 135-080, korea tel: 02-558-3737 http://www.kr.necel.com/ for further information, please contact: g0706 [europe] nec electronics (europe) gmbh arcadiastrasse 10 40472 dsseldorf, germany tel: 0211-65030 http://www.eu.necel.com/ hanover office podbielskistrasse 166 b 30177 hannover tel: 0 511 33 40 2-0 munich office werner-eckert-strasse 9 81829 mnchen tel: 0 89 92 10 03-0 stuttgart office industriestrasse 3 70565 stuttgart tel: 0 711 99 01 0-0 united kingdom branch cygnus house, sunrise parkway linford wood, milton keynes mk14 6np, u.k. tel: 01908-691-133 succursale fran?aise 9, rue paul dautier, b.p. 52 78142 velizy-villacoublay cdex france tel: 01-3067-5800 sucursal en espa?a juan esplandiu, 15 28007 madrid, spain tel: 091-504-2787 tyskland filial t?by centrum entrance s (7th floor) 18322 t?by, sweden tel: 08 638 72 00 filiale italiana via fabio filzi, 25/a 20124 milano, italy tel: 02-667541 branch the netherlands steijgerweg 6 5616 hs eindhoven the netherlands tel: 040 265 40 10


▲Up To Search▲   

 
Price & Availability of UPD70F3288GJ-UEN-A

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X